Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat: ai-011y quickfilters support (#12406)

Nityananda Gohainc36b748370b3
diff --git a/pkg/types/quickfiltertypes/filter.go b/pkg/types/quickfiltertypes/filter.go
index 55a6f8c497..4aaa259258 100644
--- a/pkg/types/quickfiltertypes/filter.go
+++ b/pkg/types/quickfiltertypes/filter.go
@@ -7,6 +7,7 @@ import (
"github.com/SigNoz/signoz/pkg/errors"
v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3"
"github.com/SigNoz/signoz/pkg/types"
+ "github.com/SigNoz/signoz/pkg/types/telemetrytypes"
"github.com/SigNoz/signoz/pkg/valuer"
"github.com/uptrace/bun"
)
@@ -31,11 +32,12 @@ func (enum *Signal) UnmarshalJSON(data []byte) error {
}
var (
- SignalTraces = Signal{valuer.NewString("traces")}
- SignalLogs = Signal{valuer.NewString("logs")}
- SignalApiMonitoring = Signal{valuer.NewString("api_monitoring")}
- SignalExceptions = Signal{valuer.NewString("exceptions")}
- SignalMeter = Signal{valuer.NewString("meter")}
+ SignalTraces = Signal{valuer.NewString("traces")}
+ SignalLogs = Signal{valuer.NewString("logs")}
+ SignalApiMonitoring = Signal{valuer.NewString("api_monitoring")}
+ SignalExceptions = Signal{valuer.NewString("exceptions")}
+ SignalMeter = Signal{valuer.NewString("meter")}
+ SignalAiObservability = Signal{valuer.NewString("ai_observability")}
)
// NewSignal creates a Signal from a string.
@@ -51,6 +53,8 @@ func NewSignal(s string) (Signal, error) {
return SignalExceptions, nil
case "meter":
return SignalMeter, nil
+ case "ai_observability":
+ return SignalAiObservability, nil
default:
return Signal{}, errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "invalid signal: %s", s)
}
@@ -187,6 +191,18 @@ func NewDefaultQuickFilter(orgID valuer.UUID) ([]*StorableQuickFilter, error) {
{"key": "host.name", "dataType": "float64", "type": "Sum"},
}
+ // AI observability (builder_ai_query trace explorer), ordered by expected
+ // usage: env scoping, the LLM identity keys, then service and the rest.
+ aiObservabilityFilters := []map[string]interface{}{
+ {"key": "deployment.environment", "dataType": "string", "type": "resource"},
+ {"key": telemetrytypes.GenAIOperationName, "dataType": "string", "type": "tag"},
+ {"key": telemetrytypes.GenAIProviderName, "dataType": "string", "type": "tag"},
+ {"key": telemetrytypes.GenAIRequestModel, "dataType": "string", "type": "tag"},
+ {"key": "service.name", "dataType": "string", "type": "resource"},
+ {"key": telemetrytypes.GenAIToolName, "dataType": "string", "type": "tag"},
+ {"key": telemetrytypes.GenAIAgentName, "dataType": "string", "type": "tag"},
+ }
+
tracesJSON, err := json.Marshal(tracesFilters)
if err != nil {
return nil, errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "failed to marshal traces filters")
@@ -212,6 +228,11 @@ func NewDefaultQuickFilter(orgID valuer.UUID) ([]*StorableQuickFilter, error) {
return nil, errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "failed to marshal meter filters")
}
+ aiObservabilityJSON, err := json.Marshal(aiObservabilityFilters)
+ if err != nil {
+ return nil, errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "failed to marshal ai observability filters")
+ }
+
timeRightNow := time.Now()
return []*StorableQuickFilter{
@@ -275,5 +296,17 @@ func NewDefaultQuickFilter(orgID valuer.UUID) ([]*StorableQuickFilter, error) {
UpdatedAt: timeRightNow,
},
},
+ {
+ Identifiable: types.Identifiable{
+ ID: valuer.GenerateUUID(),
+ },
+ OrgID: orgID,
+ Filter: string(aiObservabilityJSON),
+ Signal: SignalAiObservability,
+ TimeAuditable: types.TimeAuditable{
+ CreatedAt: timeRightNow,
+ UpdatedAt: timeRightNow,
+ },
+ },
}, nil
}
diff --git a/pkg/types/telemetrytypes/genai_semconv.go b/pkg/types/telemetrytypes/genai_semconv.go
index 340f42bdaa..b6b1569da2 100644
--- a/pkg/types/telemetrytypes/genai_semconv.go
+++ b/pkg/types/telemetrytypes/genai_semconv.go
@@ -3,10 +3,11 @@ package telemetrytypes
// OpenTelemetry gen_ai semantic-convention attribute keys. Single source of truth
// shared by the AI query builder and the LLM pricing pipeline.
const (
- GenAIRequestModel = "gen_ai.request.model"
- GenAIToolName = "gen_ai.tool.name"
- GenAIAgentName = "gen_ai.agent.name"
- GenAIProviderName = "gen_ai.provider.name"
+ GenAIRequestModel = "gen_ai.request.model"
+ GenAIOperationName = "gen_ai.operation.name"
+ GenAIToolName = "gen_ai.tool.name"
+ GenAIAgentName = "gen_ai.agent.name"
+ GenAIProviderName = "gen_ai.provider.name"
GenAIUsageInputTokens = "gen_ai.usage.input_tokens"
GenAIUsageOutputTokens = "gen_ai.usage.output_tokens"
@@ -25,10 +26,11 @@ const (
// on, surfaced by the metadata store even before ingestion so the AI gate/columns
// resolve on a fresh install.
var GenAIFieldDefinitions = map[string]TelemetryFieldKey{
- GenAIRequestModel: {Name: GenAIRequestModel, Signal: SignalTraces, FieldContext: FieldContextAttribute, FieldDataType: FieldDataTypeString},
- GenAIToolName: {Name: GenAIToolName, Signal: SignalTraces, FieldContext: FieldContextAttribute, FieldDataType: FieldDataTypeString},
- GenAIAgentName: {Name: GenAIAgentName, Signal: SignalTraces, FieldContext: FieldContextAttribute, FieldDataType: FieldDataTypeString},
- GenAIProviderName: {Name: GenAIProviderName, Signal: SignalTraces, FieldContext: FieldContextAttribute, FieldDataType: FieldDataTypeString},
+ GenAIRequestModel: {Name: GenAIRequestModel, Signal: SignalTraces, FieldContext: FieldContextAttribute, FieldDataType: FieldDataTypeString},
+ GenAIOperationName: {Name: GenAIOperationName, Signal: SignalTraces, FieldContext: FieldContextAttribute, FieldDataType: FieldDataTypeString},
+ GenAIToolName: {Name: GenAIToolName, Signal: SignalTraces, FieldContext: FieldContextAttribute, FieldDataType: FieldDataTypeString},
+ GenAIAgentName: {Name: GenAIAgentName, Signal: SignalTraces, FieldContext: FieldContextAttribute, FieldDataType: FieldDataTypeString},
+ GenAIProviderName: {Name: GenAIProviderName, Signal: SignalTraces, FieldContext: FieldContextAttribute, FieldDataType: FieldDataTypeString},
GenAIUsageInputTokens: {Name: GenAIUsageInputTokens, Signal: SignalTraces, FieldContext: FieldContextAttribute, FieldDataType: FieldDataTypeFloat64},
GenAIUsageOutputTokens: {Name: GenAIUsageOutputTokens, Signal: SignalTraces, FieldContext: FieldContextAttribute, FieldDataType: FieldDataTypeFloat64},