Documentation
¶
Index ¶
- func BuildMetricsQueryPayloadJSON(startTime, endTime, stepInterval int64, queries []MetricsQuerySpec, ...) ([]byte, error)
- func MarshalReceiver(r Receiver) ([]byte, error)
- type APIAlert
- type APIAlertLabels
- type APIAlertRule
- type APIAlertRulesResponse
- type APIAlertStatus
- type APIAlertsResponse
- type AggregateOperator
- type Aggregation
- type Alert
- type AlertAggregation
- type AlertCompositeQuery
- type AlertCondition
- type AlertEvaluation
- type AlertEvaluationSchedule
- type AlertEvaluationSpec
- type AlertGroupByField
- type AlertHistoryFilters
- type AlertHistoryRequest
- type AlertOrderField
- type AlertOrderKey
- type AlertQuery
- type AlertQueryFilter
- type AlertQueryFunction
- type AlertQueryFunctionArg
- type AlertQuerySpec
- type AlertRule
- type AlertRuleSummary
- type AlertThresholds
- type AlertType
- type AttributeKey
- type BasicThreshold
- type BuilderQuery
- type BuilderQueryDashboard
- type ClickHouseSQL
- type ClickHouseSQLSpec
- type CompositeQuery
- type ContextLinks
- type CreateAlertInput
- type CreateDashboardInput
- type Dashboard
- type DataSource
- type EmailConfig
- type Filter
- type FilterItem
- type FilterSet
- type FormatOptions
- type FormulaSpec
- type Function
- type Having
- type HavingClause
- type Key
- type LayoutItem
- type ListAlertsParams
- type MSTeamsV2Config
- type MetricAggregation
- type MetricsQuerySpec
- type NotificationSettings
- type OpsgenieConfig
- type Order
- type OrderBy
- type PagerdutyConfig
- type PanelType
- type PromQL
- type PromQLSpec
- type Query
- type QueryAggregation
- type QueryFilter
- type QueryPayload
- func BuildAggregateQueryPayload(signal string, startTime, endTime int64, aggregationExpr string, ...) *QueryPayload
- func BuildLogsQueryPayload(startTime, endTime int64, filterExpression string, limit int, offset int) *QueryPayload
- func BuildMetricsQueryPayload(startTime, endTime, stepInterval int64, queries []MetricsQuerySpec, ...) *QueryPayload
- func BuildTracesQueryPayload(startTime, endTime int64, filterExpression string, limit int, offset int) *QueryPayload
- type QuerySpec
- type QueryType
- type Receiver
- type ReduceToOperator
- type Renotify
- type RuleType
- type SavedView
- type SelectField
- type SelectedLogField
- type SlackConfig
- type SpaceAggregation
- type Temporality
- type Threshold
- type TimeAggregation
- type TimePreferance
- type UpdateAlertInput
- type UpdateDashboardInput
- type Variable
- type VariableSort
- type VariableType
- type WebhookBasicAuth
- type WebhookConfig
- type WebhookHTTPConfig
- type Widget
- type WidgetQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildMetricsQueryPayloadJSON ¶ added in v0.1.0
func BuildMetricsQueryPayloadJSON(startTime, endTime, stepInterval int64, queries []MetricsQuerySpec, requestType, source string) ([]byte, error)
BuildMetricsQueryPayloadJSON builds the metrics payload and returns the marshalled JSON. It handles formula specs that need a different shape. source is an optional data-source filter (e.g. "meter" for Cost Meter queries); pass an empty string for the default SigNoz metrics store.
func MarshalReceiver ¶ added in v0.2.0
MarshalReceiver serialises a Receiver to JSON bytes suitable for the SigNoz API request body.
Types ¶
type APIAlert ¶ added in v0.0.3
type APIAlert struct {
Labels APIAlertLabels `json:"labels"`
Status APIAlertStatus `json:"status"`
StartsAt string `json:"startsAt"`
EndsAt string `json:"endsAt"`
}
type APIAlertLabels ¶ added in v0.0.3
type APIAlertRule ¶ added in v0.3.0
type APIAlertRule struct {
ID string `json:"id"`
Alert string `json:"alert"`
AlertType string `json:"alertType"`
RuleType string `json:"ruleType"`
State string `json:"state"`
Disabled bool `json:"disabled"`
Description string `json:"description"`
Labels map[string]string `json:"labels"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
CreateAt string `json:"createAt"`
UpdateAt string `json:"updateAt"`
}
APIAlertRule mirrors the compact fields used from GET /api/v2/rules.
type APIAlertRulesResponse ¶ added in v0.3.0
type APIAlertRulesResponse struct {
Status string `json:"status"`
Data []APIAlertRule `json:"data"`
}
type APIAlertStatus ¶ added in v0.0.3
type APIAlertStatus struct {
State string `json:"state"`
}
type APIAlertsResponse ¶ added in v0.0.3
type AggregateOperator ¶ added in v0.0.5
type AggregateOperator string
const ( AggregateOperatorNoop AggregateOperator = "noop" AggregateOperatorCount AggregateOperator = "count" AggregateOperatorCountDistinct AggregateOperator = "count_distinct" AggregateOperatorSum AggregateOperator = "sum" AggregateOperatorAvg AggregateOperator = "avg" AggregateOperatorMin AggregateOperator = "min" AggregateOperatorMax AggregateOperator = "max" AggregateOperatorP05 AggregateOperator = "p05" AggregateOperatorP10 AggregateOperator = "p10" AggregateOperatorP20 AggregateOperator = "p20" AggregateOperatorP25 AggregateOperator = "p25" AggregateOperatorP50 AggregateOperator = "p50" AggregateOperatorP75 AggregateOperator = "p75" AggregateOperatorP90 AggregateOperator = "p90" AggregateOperatorP95 AggregateOperator = "p95" AggregateOperatorP99 AggregateOperator = "p99" AggregateOperatorRate AggregateOperator = "rate" AggregateOperatorRateSum AggregateOperator = "rate_sum" AggregateOperatorRateAvg AggregateOperator = "rate_avg" AggregateOperatorRateMin AggregateOperator = "rate_min" AggregateOperatorRateMax AggregateOperator = "rate_max" )
type Aggregation ¶ added in v0.0.5
type Aggregation struct {
Expression string `json:"expression,omitempty"`
MetricName string `json:"metricName,omitempty"`
ReduceTo ReduceToOperator `json:"reduceTo,omitempty"`
SpaceAggregation SpaceAggregation `json:"spaceAggregation,omitempty"`
Temporality *Temporality `json:"temporality,omitempty"`
TimeAggregation TimeAggregation `json:"timeAggregation,omitempty"`
}
type Alert ¶ added in v0.0.3
type Alert struct {
Alertname string `json:"alertname"`
RuleID string `json:"ruleId"`
Severity string `json:"severity"`
StartsAt string `json:"startsAt"`
EndsAt string `json:"endsAt"`
State string `json:"state"`
WebURL string `json:"webUrl,omitempty"`
}
Alert contains only essential information
type AlertAggregation ¶ added in v0.2.0
type AlertAggregation struct {
// For metrics signal.
MetricName string `` /* 233-byte string literal not displayed */
TimeAggregation string `` /* 282-byte string literal not displayed */
SpaceAggregation string `` /* 218-byte string literal not displayed */
// For logs/traces signal.
Expression string `` /* 273-byte string literal not displayed */
}
AlertAggregation represents an aggregation in a builder query. Use one of two shapes:
- Metrics signal: set MetricName, TimeAggregation, SpaceAggregation (Expression empty).
- Logs/traces signal: set Expression (metric fields empty).
type AlertCompositeQuery ¶ added in v0.2.0
type AlertCompositeQuery struct {
QueryType QueryType `` /* 167-byte string literal not displayed */
PanelType string `json:"panelType,omitempty" jsonschema_extras:"description=Panel type. Use graph for alerts. Defaults to graph."`
Unit string `` /* 246-byte string literal not displayed */
Queries []AlertQuery `json:"queries" jsonschema:"required" jsonschema_extras:"description=Array of queries. At least one query is required."`
}
AlertCompositeQuery contains the queries that define what data to monitor.
type AlertCondition ¶ added in v0.2.0
type AlertCondition struct {
CompositeQuery AlertCompositeQuery `` /* 126-byte string literal not displayed */
SelectedQuery string `` /* 195-byte string literal not displayed */
// Absent data alerting
AlertOnAbsent bool `json:"alertOnAbsent,omitempty" jsonschema_extras:"description=Alert when no data is received within the evaluation window."`
AbsentFor uint64 `` /* 275-byte string literal not displayed */
RequireMinPoints bool `` /* 138-byte string literal not displayed */
RequiredNumPoints int `` /* 136-byte string literal not displayed */
// v1-schema anomaly-rule fields. Used only when the parent AlertRule has
// ruleType=anomaly_rule. All six are required together in that case and
// replace the v2alpha1 thresholds block.
Op string `` /* 245-byte string literal not displayed */
MatchType string `` /* 207-byte string literal not displayed */
Target interface{} `` /* 131-byte string literal not displayed */
Algorithm string `` /* 199-byte string literal not displayed */
Seasonality string `` /* 153-byte string literal not displayed */
// Threshold configuration (v2alpha1 schema). Required for threshold_rule
// and promql_rule unless alertOnAbsent is true. Omit for anomaly_rule.
Thresholds *AlertThresholds `` /* 325-byte string literal not displayed */
}
AlertCondition defines when an alert should fire.
type AlertEvaluation ¶ added in v0.2.0
type AlertEvaluation struct {
Kind string `` /* 328-byte string literal not displayed */
Spec AlertEvaluationSpec `` /* 193-byte string literal not displayed */
}
AlertEvaluation holds the evaluation schedule for v2 schema alerts.
type AlertEvaluationSchedule ¶ added in v0.4.2
type AlertEvaluationSchedule struct {
Type string `json:"type" jsonschema:"required" jsonschema_extras:"description=Reset cadence: daily or monthly."`
Minute int `json:"minute" jsonschema_extras:"description=Minute of the reset boundary (0-59); e.g. 0 for the top of the hour."`
Hour int `json:"hour" jsonschema_extras:"description=Hour of the reset boundary (0-23); e.g. 0 for midnight."`
}
AlertEvaluationSchedule is the reset schedule for a cumulative evaluation window.
type AlertEvaluationSpec ¶ added in v0.2.0
type AlertEvaluationSpec struct {
EvalWindow string `` /* 154-byte string literal not displayed */
Frequency string `` /* 135-byte string literal not displayed */
Schedule *AlertEvaluationSchedule `` /* 137-byte string literal not displayed */
Timezone string `` /* 131-byte string literal not displayed */
}
AlertEvaluationSpec defines the evaluation window. Rolling uses evalWindow+frequency; cumulative uses schedule+frequency+timezone.
type AlertGroupByField ¶ added in v0.2.0
type AlertGroupByField struct {
Name string `` /* 141-byte string literal not displayed */
FieldContext string `` /* 176-byte string literal not displayed */
FieldDataType string `json:"fieldDataType,omitempty" jsonschema_extras:"description=Data type of the field: string or int64 or float64 or bool."`
}
AlertGroupByField identifies a field to group by.
type AlertHistoryFilters ¶
type AlertHistoryFilters struct {
Items []interface{} `json:"items"`
Op string `json:"op"`
}
AlertHistoryFilters is filters for alert history
type AlertHistoryRequest ¶
type AlertHistoryRequest struct {
Start int64 `json:"start"`
End int64 `json:"end"`
State string `json:"state,omitempty"`
Offset int `json:"offset"`
Limit int `json:"limit"`
Order string `json:"order"`
Filters AlertHistoryFilters `json:"filters"`
}
AlertHistoryRequest is the request payload for alert history
type AlertOrderField ¶ added in v0.2.0
type AlertOrderField struct {
Key AlertOrderKey `json:"key" jsonschema:"required"`
Direction string `json:"direction" jsonschema:"required" jsonschema_extras:"description=Sort direction: asc or desc."`
}
AlertOrderField specifies ordering for query results.
type AlertOrderKey ¶ added in v0.2.0
type AlertOrderKey struct {
Name string `` /* 138-byte string literal not displayed */
}
AlertOrderKey identifies the field to order by.
type AlertQuery ¶ added in v0.2.0
type AlertQuery struct {
Type string `` /* 289-byte string literal not displayed */
Spec AlertQuerySpec `json:"spec" jsonschema:"required" jsonschema_extras:"description=Query specification."`
}
AlertQuery wraps a single query within the composite query.
type AlertQueryFilter ¶ added in v0.2.0
type AlertQueryFilter struct {
Expression string `` /* 184-byte string literal not displayed */
}
AlertQueryFilter holds a filter or having expression.
type AlertQueryFunction ¶ added in v0.3.0
type AlertQueryFunction struct {
Name string `json:"name" jsonschema:"required" jsonschema_extras:"description=Function name (e.g. anomaly for ruleType=anomaly_rule)."`
Args []AlertQueryFunctionArg `` /* 133-byte string literal not displayed */
}
AlertQueryFunction applies a post-query transform to a builder query series. Most commonly used for anomaly detection on metrics.
type AlertQueryFunctionArg ¶ added in v0.3.0
type AlertQueryFunctionArg struct {
Name string `json:"name" jsonschema:"required" jsonschema_extras:"description=Argument name (e.g. z_score_threshold)."`
Value interface{} `` /* 128-byte string literal not displayed */
}
AlertQueryFunctionArg is a single argument to an AlertQueryFunction.
type AlertQuerySpec ¶ added in v0.2.0
type AlertQuerySpec struct {
Name string `` /* 149-byte string literal not displayed */
Signal string `` /* 148-byte string literal not displayed */
StepInterval *int64 `` /* 135-byte string literal not displayed */
Disabled bool `json:"disabled,omitempty" jsonschema_extras:"description=Whether this query is disabled."`
Source string `` /* 213-byte string literal not displayed */
Aggregations []AlertAggregation `` /* 346-byte string literal not displayed */
Filter *AlertQueryFilter `` /* 170-byte string literal not displayed */
GroupBy []AlertGroupByField `` /* 136-byte string literal not displayed */
Order []AlertOrderField `json:"order,omitempty" jsonschema_extras:"description=Order by specification."`
Having *AlertQueryFilter `json:"having,omitempty" jsonschema_extras:"description=Having clause to filter aggregation results."`
Functions []AlertQueryFunction `` /* 201-byte string literal not displayed */
// For promql / clickhouse_sql query types
Query string `` /* 433-byte string literal not displayed */
Legend string `json:"legend,omitempty" jsonschema_extras:"description=Legend template for the query."`
// For builder_formula type
Expression string `` /* 159-byte string literal not displayed */
}
AlertQuerySpec is the specification for a single query within an alert. For builder_query type this uses the v5 query builder format. For promql/clickhouse_sql types only name query legend and disabled are used.
type AlertRule ¶ added in v0.2.0
type AlertRule struct {
Alert string `json:"alert" jsonschema:"required" jsonschema_extras:"description=Name of the alert rule. Must be unique and descriptive."`
AlertType AlertType `` /* 171-byte string literal not displayed */
RuleType RuleType `` /* 208-byte string literal not displayed */
Description string `json:"description,omitempty" jsonschema_extras:"description=Human-readable description of what this alert monitors."`
Condition AlertCondition `` /* 136-byte string literal not displayed */
Labels map[string]string `` /* 376-byte string literal not displayed */
Annotations map[string]string `` /* 242-byte string literal not displayed */
Disabled bool `json:"disabled,omitempty" jsonschema_extras:"description=Whether the alert rule is disabled. Defaults to false (enabled)."`
Source string `json:"source,omitempty" jsonschema_extras:"description=Source URL for the alert. Set automatically."`
PreferredChannels []string `` /* 187-byte string literal not displayed */
Version string `json:"version,omitempty" jsonschema_extras:"description=API version. Always v5. Set automatically if omitted."`
// v1-schema fields (used only when ruleType=anomaly_rule).
EvalWindow string `` /* 225-byte string literal not displayed */
Frequency string `` /* 220-byte string literal not displayed */
// v2alpha1 schema fields (used for threshold_rule and promql_rule).
Evaluation *AlertEvaluation `` /* 382-byte string literal not displayed */
SchemaVersion string `` /* 185-byte string literal not displayed */
NotificationSettings *NotificationSettings `` /* 197-byte string literal not displayed */
}
AlertRule is the payload for creating an alert rule via POST /api/v2/rules. It matches the SigNoz PostableRule structure. Threshold and PromQL rules use the v2alpha1 schema (structured thresholds + evaluation + notificationSettings). Anomaly rules use the v1 schema: top-level evalWindow/frequency with condition.op/matchType/target/algorithm/seasonality (no thresholds block).
type AlertRuleSummary ¶ added in v0.3.0
type AlertRuleSummary struct {
RuleID string `json:"ruleId"`
Alert string `json:"alert"`
AlertType string `json:"alertType"`
RuleType string `json:"ruleType"`
State string `json:"state"`
Disabled bool `json:"disabled"`
Severity string `json:"severity,omitempty"`
Description string `json:"description,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
WebURL string `json:"webUrl,omitempty"`
}
AlertRuleSummary contains the fields needed to discover configured rules.
type AlertThresholds ¶ added in v0.2.0
type AlertThresholds struct {
Kind string `json:"kind" jsonschema:"required" jsonschema_extras:"description=Threshold kind. Currently only basic is supported."`
Spec []BasicThreshold `` /* 148-byte string literal not displayed */
}
AlertThresholds holds multi-threshold configuration for v2 schema alerts.
type AlertType ¶ added in v0.2.0
type AlertType string
AlertType identifies the signal an alert monitors.
type AttributeKey ¶ added in v0.0.5
type AttributeKey struct {
Key string `json:"key,omitempty" jsonschema_extras:"description=Key for the attribute"`
Name string `json:"name,omitempty" jsonschema_extras:"description=Name for the attribute (alternative to key)"`
DataType string `json:"dataType,omitempty" jsonschema_extras:"description=Data type of the attribute"`
Type string `json:"type,omitempty" jsonschema_extras:"description=Type of the attribute (tag, resource, log, etc.)"`
IsColumn bool `json:"isColumn,omitempty" jsonschema_extras:"description=Whether the attribute is a materialized column or not"`
IsJSON bool `json:"isJSON,omitempty" jsonschema_extras:"description=Whether the attribute is a JSON or not"`
ID string `json:"id,omitempty"`
FieldContext string `` /* 132-byte string literal not displayed */
FieldDataType string `json:"fieldDataType,omitempty" jsonschema_extras:"description=Field data type"`
Signal string `json:"signal,omitempty" jsonschema_extras:"description=Signal type (traces, logs, metrics) - Required for selectColumns"`
}
type BasicThreshold ¶ added in v0.2.0
type BasicThreshold struct {
Name string `` /* 198-byte string literal not displayed */
Target *float64 `json:"target" jsonschema:"required" jsonschema_extras:"description=Threshold value to compare against."`
TargetUnit string `` /* 228-byte string literal not displayed */
RecoveryTarget *float64 `` /* 284-byte string literal not displayed */
MatchType string `` /* 267-byte string literal not displayed */
CompareOp string `` /* 327-byte string literal not displayed */
Channels []string `` /* 229-byte string literal not displayed */
}
BasicThreshold defines a single threshold level with routing.
type BuilderQuery ¶ added in v0.0.5
type BuilderQuery struct {
QueryName string `json:"queryName" jsonschema:"required" jsonschema_extras:"description=Name of the query"`
StepInterval *int64 `json:"stepInterval" jsonschema:"required" jsonschema_extras:"description=Step/Aggregation interval for the query in seconds."`
DataSource DataSource `json:"dataSource" jsonschema:"required" jsonschema_extras:"description=Data source for the query"`
AggregateOperator AggregateOperator `json:"aggregateOperator,omitempty" jsonschema_extras:"description=Aggregate operator for the query"`
AggregateAttribute AttributeKey `json:"aggregateAttribute,omitempty"`
Temporality Temporality `json:"temporality,omitempty" jsonschema_extras:"description=Temporality for metrics data"`
Filters FilterSet `json:"filters,omitempty"`
GroupBy []AttributeKey `json:"groupBy" jsonschema_extras:"description=Group by attributes for the query"`
Expression string `json:"expression" jsonschema:"required" jsonschema_extras:"description=Expression for the query"`
Disabled bool `json:"disabled,omitempty" jsonschema_extras:"description=Whether the query is disabled"`
Having interface{} `json:"having,omitempty" jsonschema_extras:"description=Having clauses for the query"`
Legend string `` /* 500-byte string literal not displayed */
Limit uint64 `json:"limit,omitempty" jsonschema_extras:"description=Limit for the query"`
Offset uint64 `json:"offset,omitempty" jsonschema_extras:"description=Offset for the query"`
PageSize uint64 `json:"pageSize,omitempty" jsonschema_extras:"description=Page size for the query"`
OrderBy []OrderBy `json:"orderBy" jsonschema_extras:"description=Order by for the query"`
ReduceTo ReduceToOperator `json:"reduceTo,omitempty" jsonschema_extras:"description=Reduce to operator for the query"`
SelectColumns []AttributeKey `json:"selectColumns" jsonschema_extras:"description=Select columns for the query. Required for list panel types."`
TimeAggregation TimeAggregation `json:"timeAggregation,omitempty" jsonschema_extras:"description=Time aggregation for metrics queries"`
SpaceAggregation SpaceAggregation `json:"spaceAggregation,omitempty" jsonschema_extras:"description=Space aggregation for metrics queries"`
SeriesAggregation string `json:"seriesAggregation,omitempty" jsonschema_extras:"description=Series aggregation for metrics queries with group by"`
Functions []Function `json:"functions" jsonschema_extras:"description=Functions to apply to the query result"`
Aggregations []Aggregation `json:"aggregations"`
Filter *QueryFilter `json:"filter,omitempty"`
Source string `json:"source,omitempty"`
}
type BuilderQueryDashboard ¶ added in v0.0.5
type BuilderQueryDashboard struct {
QueryData []BuilderQuery `json:"queryData" jsonschema_extras:"description=Query data for the widget. Populate with non-formula queries."`
QueryFormulas []BuilderQuery `json:"queryFormulas" jsonschema_extras:"description=Query formulas for the widget. Populate with formula queries."`
QueryTraceOperator []interface{} `json:"queryTraceOperator,omitempty"`
}
type ClickHouseSQL ¶ added in v0.0.5
type ClickHouseSQL struct {
Query string `json:"query" jsonschema:"required" jsonschema_extras:"description=Clickhouse SQL query for the widget"`
Name string `json:"name" jsonschema:"required" jsonschema_extras:"description=Name for the query"`
Disabled bool `json:"disabled" jsonschema:"required" jsonschema_extras:"description=Whether the Clickhouse SQL is disabled or not"`
Legend string `` /* 360-byte string literal not displayed */
}
type ClickHouseSQLSpec ¶ added in v0.4.1
type ClickHouseSQLSpec struct {
Name string `json:"name"`
Query string `json:"query"`
Disabled bool `json:"disabled,omitempty"`
Legend string `json:"legend,omitempty"`
}
ClickHouseSQLSpec is the spec for a query envelope with Type="clickhouse_sql".
type CompositeQuery ¶
type CompositeQuery struct {
Queries []Query `json:"queries"`
}
type ContextLinks ¶ added in v0.0.5
type ContextLinks struct {
LinksData []interface{} `json:"linksData"`
}
type CreateAlertInput ¶ added in v0.3.0
type CreateDashboardInput ¶ added in v0.3.0
type Dashboard ¶ added in v0.0.5
type Dashboard struct {
Title string `json:"title" jsonschema:"required" jsonschema_extras:"description=The display name of the dashboard."`
Description string `json:"description,omitempty" jsonschema_extras:"description=A brief explanation of what the dashboard shows."`
Tags []string `json:"tags,omitempty" jsonschema_extras:"description=Keywords for categorization e.g performance latency."`
Layout []LayoutItem `json:"layout" jsonschema:"required" jsonschema_extras:"description=Defines the grid positioning and size for each widget."`
Variables map[string]Variable `json:"variables,omitempty" jsonschema_extras:"description=Key-value map of template variables available for queries."`
Widgets []Widget `` /* 133-byte string literal not displayed */
}
type DataSource ¶ added in v0.0.5
type DataSource string
const ( DataSourceMetrics DataSource = "metrics" DataSourceLogs DataSource = "logs" DataSourceTraces DataSource = "traces" )
type EmailConfig ¶ added in v0.2.0
type EmailConfig struct {
SendResolved bool `json:"send_resolved"`
To string `json:"to"`
HTML string `json:"html,omitempty"`
}
EmailConfig mirrors the SigNoz/Alertmanager email_configs entry.
type FilterItem ¶ added in v0.0.5
type FilterItem struct {
Key AttributeKey `json:"key" jsonschema:"required" jsonschema_extras:"description=Key for the filter"`
Value interface{} `json:"value" jsonschema:"required" jsonschema_extras:"description=Value for the filter"`
Op string `json:"op" jsonschema:"required" jsonschema_extras:"description=Filter operator"`
ID string `json:"id,omitempty"`
}
type FilterSet ¶ added in v0.0.5
type FilterSet struct {
Items []FilterItem `json:"items" jsonschema:"required"`
Op string `json:"op" jsonschema:"required" jsonschema_extras:"description=Operator for combining filter items."`
}
type FormatOptions ¶
type FormulaSpec ¶ added in v0.1.0
type FormulaSpec struct {
Name string `json:"name"`
Expression string `json:"expression"`
Legend string `json:"legend,omitempty"`
Disabled bool `json:"disabled"`
}
FormulaSpec is the spec shape for builder_formula queries. We marshal it separately because it differs from QuerySpec.
type Function ¶ added in v0.0.5
type Function struct {
Name string `json:"name" jsonschema:"required" jsonschema_extras:"description=Function name"`
Args []interface{} `json:"args" jsonschema_extras:"description=Function arguments"`
NamedArgs map[string]interface{} `json:"namedArgs,omitempty" jsonschema_extras:"description=Named arguments for the function"`
}
type HavingClause ¶ added in v0.0.5
type HavingClause struct {
ColumnName string `json:"columnName" jsonschema:"required" jsonschema_extras:"description=Column name for the having clause."`
Op string `json:"op" jsonschema:"required" jsonschema_extras:"description=Operator for the having clause"`
Value interface{} `json:"value" jsonschema:"required" jsonschema_extras:"description=Value for the having clause."`
Expression string `json:"expression,omitempty"`
}
type LayoutItem ¶ added in v0.0.5
type LayoutItem struct {
X int `json:"x" jsonschema:"required" jsonschema_extras:"description=X coordinate for the layout"`
Y int `json:"y" jsonschema:"required" jsonschema_extras:"description=Y coordinate for the layout"`
W int `json:"w" jsonschema:"required" jsonschema_extras:"description=Width for the layout"`
H int `json:"h" jsonschema:"required" jsonschema_extras:"description=Height for the layout"`
I string `json:"i" jsonschema:"required" jsonschema_extras:"description=ID for the layout"`
Moved bool `json:"moved,omitempty" jsonschema_extras:"description=Whether the layout is moved or not"`
Static bool `json:"static,omitempty" jsonschema_extras:"description=Whether the layout is static or not"`
MaxH int `json:"maxH,omitempty"`
MinH int `json:"minH,omitempty"`
MinW int `json:"minW,omitempty"`
IsDraggable bool `json:"isDraggable,omitempty"`
}
type ListAlertsParams ¶ added in v0.1.0
type ListAlertsParams struct {
Active *bool
Filter []string
Inhibited *bool
Receiver string
Silenced *bool
}
ListAlertsParams contains query parameters for the GET /api/v1/alerts endpoint.
func (ListAlertsParams) QueryParams ¶ added in v0.1.0
func (p ListAlertsParams) QueryParams() url.Values
QueryParams converts the params to url.Values for the HTTP request.
type MSTeamsV2Config ¶ added in v0.2.0
type MSTeamsV2Config struct {
SendResolved bool `json:"send_resolved"`
WebhookURL string `json:"webhook_url"`
Title string `json:"title,omitempty"`
Text string `json:"text,omitempty"`
}
MSTeamsV2Config mirrors the SigNoz/Alertmanager msteamsv2_configs entry.
type MetricAggregation ¶ added in v0.1.0
type MetricAggregation struct {
MetricName string `json:"metricName"`
Temporality string `json:"temporality,omitempty"`
TimeAggregation string `json:"timeAggregation,omitempty"`
SpaceAggregation string `json:"spaceAggregation"`
ReduceTo string `json:"reduceTo,omitempty"`
}
MetricAggregation represents a metric-specific aggregation in the v5 payload.
type MetricsQuerySpec ¶ added in v0.1.0
type MetricsQuerySpec struct {
Name string
Aggregation MetricAggregation
Filter string
GroupBy []SelectField
IsFormula bool // if true, Expression is used instead of Aggregation
Expression string // formula: "A / B * 100"
Legend string
}
MetricsQuerySpec describes a single metric query or formula within a composite query.
type NotificationSettings ¶ added in v0.2.0
type NotificationSettings struct {
GroupBy []string `` /* 207-byte string literal not displayed */
NewGroupEvalDelay string `` /* 238-byte string literal not displayed */
Renotify *Renotify `json:"renotify,omitempty" jsonschema_extras:"description=Re-notification configuration."`
UsePolicy bool `` /* 247-byte string literal not displayed */
}
NotificationSettings controls alert notification behavior for v2alpha1 rules.
type OpsgenieConfig ¶ added in v0.2.0
type OpsgenieConfig struct {
SendResolved bool `json:"send_resolved"`
APIKey string `json:"api_key"`
Message string `json:"message,omitempty"`
Description string `json:"description,omitempty"`
Priority string `json:"priority,omitempty"`
}
OpsgenieConfig mirrors the SigNoz/Alertmanager opsgenie_configs entry.
type PagerdutyConfig ¶ added in v0.2.0
type PagerdutyConfig struct {
SendResolved bool `json:"send_resolved"`
RoutingKey string `json:"routing_key"`
Description string `json:"description,omitempty"`
Severity string `json:"severity,omitempty"`
}
PagerdutyConfig mirrors the SigNoz/Alertmanager pagerduty_configs entry.
type PanelType ¶ added in v0.0.5
type PanelType string
const ( PanelTypeGraph PanelType = "graph" PanelTypeTable PanelType = "table" PanelTypeValue PanelType = "value" PanelTypeList PanelType = "list" PanelTypeTrace PanelType = "trace" PanelTypePie PanelType = "pie" PanelTypeRow PanelType = "row" PanelTypeBar PanelType = "bar" PanelTypeHistogram PanelType = "histogram" )
type PromQL ¶ added in v0.0.5
type PromQL struct {
Query string `` /* 333-byte string literal not displayed */
Name string `json:"name" jsonschema:"required" jsonschema_extras:"description=Name for the query"`
Disabled bool `json:"disabled" jsonschema:"required" jsonschema_extras:"description=Whether the PromQL query is disabled or not"`
Legend string `` /* 324-byte string literal not displayed */
}
type PromQLSpec ¶ added in v0.4.1
type PromQLSpec struct {
Name string `json:"name"`
Query string `json:"query"`
Disabled bool `json:"disabled,omitempty"`
Step any `json:"step,omitempty"`
Stats bool `json:"stats,omitempty"`
Legend string `json:"legend,omitempty"`
}
PromQLSpec is the spec for a query envelope with Type="promql". Mirrors signoz/pkg/types/querybuildertypes/querybuildertypesv5.PromQuery — Step is left as any so callers can pass either a Go-duration string ("60s", "1m") or a number of seconds, matching the backend's OneOf schema.
type Query ¶
Query is a single entry in CompositeQuery.Queries. Spec's concrete type depends on Type:
- "builder_query" -> QuerySpec
- "builder_formula" -> FormulaSpec
- "promql" -> PromQLSpec
- "clickhouse_sql" -> ClickHouseSQLSpec
- anything else (e.g. "builder_trace_operator", "builder_sub_query", "builder_join") -> json.RawMessage, preserved byte-for-byte so the backend sees the caller's original spec.
Note: builder_formula is a sibling envelope type, not a kind of builder_query. Formulas reference other queries' results by name (e.g. "A / B * 100") and carry only name/expression/legend/disabled.
func (*Query) UnmarshalJSON ¶ added in v0.4.1
UnmarshalJSON decodes Spec into the right concrete type based on Type, so PromQL / ClickHouse SQL query strings survive the typed round-trip in signoz_execute_builder_query instead of being silently dropped.
type QueryAggregation ¶ added in v0.0.5
type QueryAggregation struct {
Expression string `json:"expression"`
}
QueryAggregation represents an aggregation expression for QB v5 queries (logs, traces). Example expressions: "count()", "avg(duration)", "p99(durationNano)", "count_distinct(user_id)"
type QueryFilter ¶ added in v0.0.5
type QueryFilter struct {
Expression string `json:"expression,omitempty"`
}
type QueryPayload ¶
type QueryPayload struct {
SchemaVersion string `json:"schemaVersion"`
Start int64 `json:"start"`
End int64 `json:"end"`
RequestType string `json:"requestType"`
CompositeQuery CompositeQuery `json:"compositeQuery"`
FormatOptions FormatOptions `json:"formatOptions"`
Variables map[string]any `json:"variables"`
}
QueryPayload is struct used as payload the Query Builder v5 JSON schema
func BuildAggregateQueryPayload ¶ added in v0.0.5
func BuildAggregateQueryPayload(signal string, startTime, endTime int64, aggregationExpr string, filterExpression string, groupBy []SelectField, orderByExpr string, orderDir string, limit int, requestType string, stepInterval *int64) *QueryPayload
BuildAggregateQueryPayload creates a QueryPayload for aggregation queries, signal is "logs" or "traces". aggregationExpr is a QB v5 expression like "count()", "avg(duration)", "p99(durationNano)". groupBy is a list of fields to group by. orderByExpr is the expression to order by (e.g. "count()"), orderDir is "asc" or "desc".
func BuildLogsQueryPayload ¶
func BuildLogsQueryPayload(startTime, endTime int64, filterExpression string, limit int, offset int) *QueryPayload
BuildLogsQueryPayload creates a QueryPayload for logs queries
func BuildMetricsQueryPayload ¶ added in v0.1.0
func BuildMetricsQueryPayload(startTime, endTime, stepInterval int64, queries []MetricsQuerySpec, requestType string) *QueryPayload
BuildMetricsQueryPayload creates a QueryPayload for metrics queries. It supports multiple builder queries and formulas in a single composite query.
func BuildTracesQueryPayload ¶
func BuildTracesQueryPayload(startTime, endTime int64, filterExpression string, limit int, offset int) *QueryPayload
func (*QueryPayload) Validate ¶
func (q *QueryPayload) Validate() error
Validate performs necessary validation for required fields this indirectly helps LLMs to build right payload. if there is an error LLM checks the error and fix.
type QuerySpec ¶
type QuerySpec struct {
Name string `json:"name"`
Signal string `json:"signal"`
Source string `json:"source,omitempty"`
StepInterval *int64 `json:"stepInterval,omitempty"`
Disabled bool `json:"disabled"`
Filter *Filter `json:"filter,omitempty"`
Limit int `json:"limit"`
Offset int `json:"offset"`
Order []Order `json:"order"`
Having Having `json:"having"`
SelectFields []SelectField `json:"selectFields"`
Aggregations []any `json:"aggregations,omitempty"`
GroupBy []SelectField `json:"groupBy,omitempty"`
}
type Receiver ¶ added in v0.2.0
type Receiver struct {
Name string `json:"name"`
SlackConfigs []SlackConfig `json:"slack_configs,omitempty"`
WebhookConfigs []WebhookConfig `json:"webhook_configs,omitempty"`
PagerdutyConfigs []PagerdutyConfig `json:"pagerduty_configs,omitempty"`
EmailConfigs []EmailConfig `json:"email_configs,omitempty"`
OpsgenieConfigs []OpsgenieConfig `json:"opsgenie_configs,omitempty"`
MSTeamsV2Configs []MSTeamsV2Config `json:"msteamsv2_configs,omitempty"`
}
Receiver is the top-level structure sent to SigNoz's /api/v1/channels and /api/v1/testChannel endpoints. Only one of the *_configs fields should be populated per receiver.
type ReduceToOperator ¶ added in v0.0.5
type ReduceToOperator string
const ( ReduceToLast ReduceToOperator = "last" ReduceToSum ReduceToOperator = "sum" ReduceToAvg ReduceToOperator = "avg" ReduceToMin ReduceToOperator = "min" ReduceToMax ReduceToOperator = "max" )
type Renotify ¶ added in v0.2.0
type Renotify struct {
Enabled bool `json:"enabled" jsonschema_extras:"description=Whether re-notification is enabled."`
Interval string `` /* 131-byte string literal not displayed */
AlertStates []string `` /* 163-byte string literal not displayed */
}
Renotify controls re-notification behavior.
type RuleType ¶ added in v0.2.0
type RuleType string
RuleType identifies how the alert condition is evaluated.
type SavedView ¶ added in v0.3.0
type SavedView struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Category string `json:"category,omitempty"`
SourcePage string `json:"sourcePage"`
Tags []string `json:"tags,omitempty"`
CompositeQuery json.RawMessage `json:"compositeQuery"`
ExtraData string `json:"extraData,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
CreatedBy string `json:"createdBy,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
UpdatedBy string `json:"updatedBy,omitempty"`
}
SavedView mirrors the SigNoz server SavedView model (pkg/query-service/model/v3/v3.go). Used for responses and internal wire formatting.
type SelectField ¶
type SelectedLogField ¶ added in v0.0.5
type SelectedLogField struct {
DataType string `json:"dataType,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
FieldContext string `json:"fieldContext,omitempty"`
FieldDataType string `json:"fieldDataType,omitempty"`
IsIndexed bool `json:"isIndexed,omitempty"`
Signal string `json:"signal,omitempty"`
IsColumn bool `json:"isColumn,omitempty"`
IsJSON bool `json:"isJSON,omitempty"`
}
type SlackConfig ¶ added in v0.2.0
type SlackConfig struct {
SendResolved bool `json:"send_resolved"`
APIURL string `json:"api_url"`
Channel string `json:"channel,omitempty"`
Title string `json:"title,omitempty"`
Text string `json:"text,omitempty"`
}
SlackConfig mirrors the SigNoz/Alertmanager slack_configs entry.
type SpaceAggregation ¶ added in v0.0.5
type SpaceAggregation string
const ( SpaceAggregationSum SpaceAggregation = "sum" SpaceAggregationAvg SpaceAggregation = "avg" SpaceAggregationMin SpaceAggregation = "min" SpaceAggregationMax SpaceAggregation = "max" SpaceAggregationCount SpaceAggregation = "count" SpaceAggregationP50 SpaceAggregation = "p50" SpaceAggregationP75 SpaceAggregation = "p75" SpaceAggregationP90 SpaceAggregation = "p90" SpaceAggregationP95 SpaceAggregation = "p95" SpaceAggregationP99 SpaceAggregation = "p99" )
type Temporality ¶ added in v0.0.5
type Temporality string
const ( TemporalityUnspecified Temporality = "Unspecified" TemporalityDelta Temporality = "Delta" TemporalityCumulative Temporality = "Cumulative" )
type Threshold ¶ added in v0.0.5
type Threshold struct {
Index string `json:"index,omitempty" jsonschema_extras:"description=Stable identifier for this threshold within the widget."`
IsEditEnabled bool `json:"isEditEnabled,omitempty"`
KeyIndex int `json:"keyIndex,omitempty"`
SelectedGraph string `json:"selectedGraph,omitempty"`
ThresholdColor string `json:"thresholdColor,omitempty" jsonschema_extras:"description=Hex color for the threshold (e.g. #FF0000)."`
ThresholdFormat string `` /* 330-byte string literal not displayed */
ThresholdLabel string `json:"thresholdLabel,omitempty" jsonschema_extras:"description=Optional display label for the threshold."`
ThresholdOperator string `` /* 130-byte string literal not displayed */
ThresholdTableOptions string `json:"thresholdTableOptions,omitempty"`
ThresholdUnit string `` /* 129-byte string literal not displayed */
ThresholdValue interface{} `json:"thresholdValue,omitempty" jsonschema_extras:"description=Numeric value the operator is compared against."`
}
type TimeAggregation ¶ added in v0.0.5
type TimeAggregation string
const ( TimeAggregationLatest TimeAggregation = "latest" TimeAggregationSum TimeAggregation = "sum" TimeAggregationAvg TimeAggregation = "avg" TimeAggregationMin TimeAggregation = "min" TimeAggregationMax TimeAggregation = "max" TimeAggregationCount TimeAggregation = "count" TimeAggregationCountDistinct TimeAggregation = "count_distinct" TimeAggregationRate TimeAggregation = "rate" TimeAggregationIncrease TimeAggregation = "increase" )
type TimePreferance ¶ added in v0.0.5
type TimePreferance string
const (
TimePreferanceGlobal TimePreferance = "GLOBAL_TIME"
)
type UpdateAlertInput ¶ added in v0.3.0
type UpdateDashboardInput ¶ added in v0.0.5
type Variable ¶ added in v0.0.5
type Variable struct {
ID string `json:"id,omitempty" jsonschema_extras:"description=ID for the variable"`
Name string `json:"name,omitempty" jsonschema_extras:"description=Name for the variable"`
Description string `json:"description,omitempty" jsonschema_extras:"description=Description for the variable"`
Key string `json:"key,omitempty" jsonschema_extras:"description=Key for the variable, use same as name"`
Type VariableType `json:"type,omitempty" jsonschema_extras:"description=Type for the variable"`
QueryValue string `json:"queryValue,omitempty" jsonschema_extras:"description=Query for the variable"`
AllSelected bool `json:"allSelected,omitempty" jsonschema_extras:"description=Whether all the values are selected or not"`
CustomValue string `json:"customValue,omitempty" jsonschema_extras:"description=Custom value for the variable"`
MultiSelect bool `json:"multiSelect,omitempty" jsonschema_extras:"description=Whether the variable is multi select or not"`
Order int `json:"order,omitempty" jsonschema_extras:"description=Order for the variable"`
ShowALLOption bool `json:"showALLOption,omitempty" jsonschema_extras:"description=Whether to show all option or not"`
Sort VariableSort `json:"sort,omitempty" jsonschema_extras:"description=Sort for the variable"`
TextboxValue string `json:"textboxValue,omitempty" jsonschema_extras:"description=Textbox value for the variable"`
ModificationUUID string `json:"modificationUUID,omitempty"`
SelectedValue interface{} `json:"selectedValue,omitempty"`
DefaultValue string `json:"defaultValue,omitempty"`
DynamicVariablesAttribute string `json:"dynamicVariablesAttribute,omitempty"`
DynamicVariablesSource string `json:"dynamicVariablesSource,omitempty"`
HaveCustomValuesSelected bool `json:"haveCustomValuesSelected,omitempty"`
}
type VariableSort ¶ added in v0.0.5
type VariableSort string
const ( VariableSortAsc VariableSort = "ASC" VariableSortDesc VariableSort = "DESC" VariableSortDisabled VariableSort = "DISABLED" )
type VariableType ¶ added in v0.0.5
type VariableType string
const ( VariableTypeQuery VariableType = "QUERY" VariableTypeConstant VariableType = "CONSTANT" VariableTypeTextbox VariableType = "TEXTBOX" VariableTypeDynamic VariableType = "DYNAMIC" VariableTypeCustom VariableType = "CUSTOM" )
type WebhookBasicAuth ¶ added in v0.2.0
type WebhookBasicAuth struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
WebhookBasicAuth holds username/password for webhook basic auth.
type WebhookConfig ¶ added in v0.2.0
type WebhookConfig struct {
SendResolved bool `json:"send_resolved"`
URL string `json:"url"`
HTTPConfig *WebhookHTTPConfig `json:"http_config,omitempty"`
}
WebhookConfig mirrors the SigNoz/Alertmanager webhook_configs entry.
type WebhookHTTPConfig ¶ added in v0.2.0
type WebhookHTTPConfig struct {
BasicAuth *WebhookBasicAuth `json:"basic_auth,omitempty"`
}
WebhookHTTPConfig holds optional basic auth for webhook channels.
type Widget ¶ added in v0.0.5
type Widget struct {
ID string `json:"id" jsonschema:"required" jsonschema_extras:"description=ID for the widget"`
Description string `json:"description,omitempty" jsonschema_extras:"description=Description for the widget"`
IsStacked bool `json:"isStacked,omitempty" jsonschema_extras:"description=Whether the widget is stacked or not"`
NullZeroValues string `json:"nullZeroValues,omitempty" jsonschema_extras:"description=Whether the widget has null zero values or not"`
Opacity string `json:"opacity,omitempty" jsonschema_extras:"description=Opacity for the widget"`
PanelTypes PanelType `json:"panelTypes" jsonschema:"required" jsonschema_extras:"description=Panel type for the widget."`
TimePreferance TimePreferance `json:"timePreferance,omitempty" jsonschema_extras:"description=Time preferance for the widget"`
Title string `json:"title" jsonschema:"required" jsonschema_extras:"description=Title for the widget"`
YAxisUnit string `json:"yAxisUnit,omitempty" jsonschema_extras:"description=Y axis unit for the widget"`
Query WidgetQuery `json:"query" jsonschema:"required" jsonschema_extras:"description=Query for the widget."`
BucketCount int `json:"bucketCount,omitempty"`
BucketWidth int `json:"bucketWidth,omitempty"`
ColumnUnits map[string]string `json:"columnUnits,omitempty"`
FillSpans bool `json:"fillSpans,omitempty"`
MergeAllActiveQueries bool `json:"mergeAllActiveQueries,omitempty"`
SelectedLogFields []SelectedLogField `json:"selectedLogFields"`
SelectedTracesFields []AttributeKey `json:"selectedTracesFields"`
SoftMax interface{} `json:"softMax,omitempty"`
SoftMin interface{} `json:"softMin,omitempty"`
StackedBarChart bool `json:"stackedBarChart,omitempty"`
Thresholds []Threshold `json:"thresholds"`
IsLogScale bool `json:"isLogScale,omitempty"`
ColumnWidths map[string]int `json:"columnWidths,omitempty"`
CustomLegendColors map[string]string `json:"customLegendColors,omitempty"`
LegendPosition string `json:"legendPosition,omitempty"`
ContextLinks ContextLinks `json:"contextLinks"`
DecimalPrecision int `json:"decimalPrecision,omitempty"`
QueryData interface{} `json:"queryData,omitempty"`
QueryType interface{} `json:"queryType,omitempty"`
}
type WidgetQuery ¶ added in v0.0.5
type WidgetQuery struct {
QueryType QueryType `json:"queryType" jsonschema:"required" jsonschema_extras:"description=Query type for the widget"`
PromQL []PromQL `json:"promql" jsonschema_extras:"description=PromQL for the widget"`
ClickHouseSQL []ClickHouseSQL `json:"clickhouse_sql" jsonschema_extras:"description=Clickhouse SQL for the widget"`
Builder BuilderQueryDashboard `json:"builder" jsonschema_extras:"description=Builder query for the widget"`
ID string `json:"id,omitempty"`
}