signoz

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2026 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Logs            Signal = "logs"
	Traces          Signal = "traces"
	Metrics         Signal = "metrics"
	MaxQueryBytes          = 1 << 20
	MaxSearchRows          = 10000
	MaxSearchOffset        = 1000000
)
View Source
const MaxAggregateTextBytes = 1 << 20

MaxAggregateTextBytes bounds the combined aggregation and filter input text in UTF-8 bytes, before JSON escaping. It is not an encoded request-body limit.

Variables

This section is empty.

Functions

func NormalizeURL

func NormalizeURL(raw string) (string, error)

func ParseCustomHeaders

func ParseCustomHeaders(raw string) (http.Header, error)

ParseCustomHeaders implements the MCP's comma-separated Name:Value format. The returned map is owned by the caller. Errors never include input text: even an invalid name or a missing delimiter can contain a credential.

Types

type AggregateRequest

type AggregateRequest struct {
	Window
	Signal             Signal
	Aggregation, Where string
	GroupBy            []string
	Limit              int
	Order              string
	Step               time.Duration // Zero means scalar; positive means time_series.
	NoCache            bool
}

func (AggregateRequest) Validate

func (r AggregateRequest) Validate() error

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(rawURL, key string, timeout time.Duration) (*Client, error)

func NewWithHeaders

func NewWithHeaders(rawURL, key string, timeout time.Duration, customHeaders string) (*Client, error)

NewWithHeaders snapshots MCP-format custom headers for this client's endpoint. Use New when no additional headers are needed. Neither constructor reads the environment, and clients never follow redirects, including same-origin ones.

func (*Client) Aggregate

func (c *Client) Aggregate(ctx context.Context, r AggregateRequest) (QueryResult, error)

func (*Client) CollectPages

func (c *Client) CollectPages(ctx context.Context, r SearchRequest, b PageBudget) (SearchResult, error)

CollectPages keeps the resolved window immutable and returns no partial success on error. Callers supply a context deadline for the whole collection.

func (*Client) FieldKeys

func (c *Client) FieldKeys(ctx context.Context, r FieldKeysRequest) (FieldKeysResult, error)

func (*Client) FieldValues

func (c *Client) FieldValues(ctx context.Context, r FieldValuesRequest) (FieldValuesResult, error)

func (*Client) Me

func (c *Client) Me(ctx context.Context) (Identity, error)

func (*Client) MetricsList

func (c *Client) MetricsList(ctx context.Context, r MetricsListRequest) (MetricsListResult, error)

func (*Client) MetricsQuery

func (c *Client) MetricsQuery(ctx context.Context, r MetricsQueryRequest) (QueryResult, error)

func (*Client) Preview

func (c *Client) Preview(ctx context.Context, q NativeQuery, verbose bool) (PreviewResult, error)

func (*Client) Query

func (c *Client) Query(ctx context.Context, q NativeQuery) (QueryResult, error)

func (*Client) Search

func (c *Client) Search(ctx context.Context, r SearchRequest) (SearchPage, error)

func (*Client) Trace

func (c *Client) Trace(ctx context.Context, r TraceRequest) (TraceResult, error)

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Status  int    `json:"http_status,omitzero"`
}

func (*Error) Error

func (e *Error) Error() string

type FieldKey

type FieldKey struct {
	Name          string `json:"name"`
	Description   string `json:"description"`
	Unit          string `json:"unit"`
	Signal        string `json:"signal"`
	FieldContext  string `json:"fieldContext"`
	FieldDataType string `json:"fieldDataType"`
}

type FieldKeysRequest

type FieldKeysRequest struct {
	Window
	Signal                                     Signal
	Limit                                      int
	Search, FieldContext, DataType, MetricName string
}

func (FieldKeysRequest) Validate

func (r FieldKeysRequest) Validate() error

type FieldKeysResult

type FieldKeysResult struct {
	Keys     map[string][]FieldKey
	Complete bool
	Raw      jsontext.Value
}

func (FieldKeysResult) Completeness

func (r FieldKeysResult) Completeness() string

type FieldValues

type FieldValues struct {
	StringValues  []string        `json:"stringValues"`
	NumberValues  []jsonv1.Number `json:"numberValues"`
	BoolValues    []bool          `json:"boolValues"`
	RelatedValues []string        `json:"relatedValues"`
}

type FieldValuesRequest

type FieldValuesRequest struct {
	FieldKeysRequest
	Name, Where string
}

func (FieldValuesRequest) Validate

func (r FieldValuesRequest) Validate() error

type FieldValuesResult

type FieldValuesResult struct {
	Values   FieldValues
	Complete bool
	Raw      jsontext.Value
}

func (FieldValuesResult) Completeness

func (r FieldValuesResult) Completeness() string

type Identity

type Identity struct {
	ID  string
	Raw jsontext.Value
}

Raw preserves fields not interpreted by the CLI, including large JSON numbers. The typed views own validation and metadata; callers never reparse envelopes.

type MetricsListRequest

type MetricsListRequest struct {
	Window
	Limit  int
	Search string
}

func (MetricsListRequest) Validate

func (r MetricsListRequest) Validate() error

type MetricsListResult

type MetricsListResult struct{ Metrics []jsontext.Value }

type MetricsQueryRequest

type MetricsQueryRequest struct {
	Window
	Expression string
	Step       time.Duration
	NoCache    bool
}

func (MetricsQueryRequest) Validate

func (r MetricsQueryRequest) Validate() error

type NativeQuery

type NativeQuery struct {
	// contains filtered or unexported fields
}

NativeQuery is validated once on input and retains the original JSON numbers and open-ended expressions. Its contents cannot be mutated by callers.

func ParseQuery

func ParseQuery(payload []byte) (NativeQuery, error)

type PageBudget

type PageBudget struct{ Pages int }

func (PageBudget) Validate

func (b PageBudget) Validate(limit int) error

type PreviewResult

type PreviewResult struct {
	Queries map[string]PreviewVerdict
	Raw     jsontext.Value
}

type PreviewVerdict

type PreviewVerdict struct {
	Valid bool
	Error jsontext.Value
}

type QueryResult

type QueryResult struct {
	Type    string
	Results []jsontext.Value
	Warning jsontext.Value
	Raw     jsontext.Value
}

type SearchPage

type SearchPage struct {
	Rows       []jsontext.Value
	NextCursor string
	Warning    jsontext.Value
	Truncated  bool
}

SearchPage contains API facts only. The collector owns continuation and completeness, including the upstream cursor's loss of timestamp ties.

type SearchRequest

type SearchRequest struct {
	Window
	Signal        Signal
	Where         string
	Limit, Offset int
}

func (SearchRequest) Validate

func (r SearchRequest) Validate() error

type SearchResult

type SearchResult struct {
	Rows         []jsontext.Value
	Pages        int
	NextOffset   *int
	NextCursor   string
	Warnings     []jsontext.Value
	Completeness string
}

type Signal

type Signal string

func (Signal) Validate

func (s Signal) Validate() error

type TraceRequest

type TraceRequest struct {
	ID, SelectedSpan string
	ExpandedSpans    []string
}

func (TraceRequest) Validate

func (r TraceRequest) Validate() error

type TraceResult

type TraceResult struct {
	Spans                    []jsontext.Value
	HasMore, HasMissingSpans bool
	Raw                      jsontext.Value
}

func (TraceResult) Completeness

func (r TraceResult) Completeness() string

type Window

type Window struct{ Start, End time.Time }

func (Window) Validate

func (w Window) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL