Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions internal/test/integration/red_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ func testSpanMetricsForHTTPLibraryOTelFormat(t *testing.T, svcName, svcNs string
`status_code="STATUS_CODE_UNSET",` + // 404 is OK for server spans
`service_namespace="` + svcNs + `",` +
`service_name="` + svcName + `",` +
`span_name="GET /basic/:rnd"` +
`span_name="GET /basic/:rnd",` +
`telemetry_sdk_language="go"` +
`}`)
require.NoError(t, err)
// check span metric latency exists
Expand Down Expand Up @@ -180,7 +181,8 @@ func testSpanMetricsForHTTPLibrary(t *testing.T, svcName, svcNs string) {
`status_code="STATUS_CODE_UNSET",` + // 404 is OK for server spans
`service_namespace="` + svcNs + `",` +
`service_name="` + svcName + `",` +
`span_name="GET /basic/:rnd"` +
`span_name="GET /basic/:rnd",` +
`telemetry_sdk_language="go"` +
`}`)
require.NoError(t, err)
// check span metric latency exists
Expand Down
4 changes: 4 additions & 0 deletions pkg/appolly/app/request/span_getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ func spanOTELGetters(name attr.Name) (attributes.Getter[*Span, attribute.KeyValu
getter = func(s *Span) attribute.KeyValue { return SpanNameMetric(s.TraceName()) }
case attr.Source:
getter = func(_ *Span) attribute.KeyValue { return SourceMetric(attr.VendorPrefix) }
case attr.TelemetrySDKLanguage:
getter = func(s *Span) attribute.KeyValue {
return semconv.TelemetrySDKLanguageKey.String(s.Service.SDKLanguage.String())
}
case attr.StatusCode:
getter = func(s *Span) attribute.KeyValue { return StatusCodeMetric(SpanStatusCode(s)) }
case attr.DBOperation:
Expand Down
23 changes: 12 additions & 11 deletions pkg/export/attributes/attr_defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,17 +337,18 @@ func getDefinitions(
// TODO: when service graph and span metrics implement attribute selection, replace this section by proper metric names
"---- temporary placeholder for span and service graph metrics ----": {
Attributes: map[attr.Name]Default{
attr.Client: false,
attr.ClientNamespace: false,
attr.Server: false,
attr.ServerNamespace: false,
attr.Source: false,
attr.ServiceName: false,
attr.ServiceInstanceID: false,
attr.ServiceNamespace: false,
attr.SpanKind: false,
attr.SpanName: false,
attr.StatusCode: false,
attr.Client: false,
attr.ClientNamespace: false,
attr.Server: false,
attr.ServerNamespace: false,
attr.Source: false,
attr.ServiceName: false,
attr.ServiceInstanceID: false,
attr.ServiceNamespace: false,
attr.SpanKind: false,
attr.SpanName: false,
attr.StatusCode: false,
attr.TelemetrySDKLanguage: false,
},
},
}
Expand Down
1 change: 1 addition & 0 deletions pkg/export/attributes/names/attrs.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const (
GraphQLOperationType = Name(semconv.GraphqlOperationTypeKey)
DNSAnswers = Name("dns.answers")
ErrorMessage = Name("error.message")
TelemetrySDKLanguage = Name(semconv.TelemetrySDKLanguageKey)

K8sNamespaceName = Name("k8s.namespace.name")
K8sPodName = Name("k8s.pod.name")
Expand Down
1 change: 1 addition & 0 deletions pkg/export/otel/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ func (mr *MetricsReporter) spanMetricAttributes() []attributes.Field[*request.Sp
attr.SpanName,
attr.StatusCode,
attr.Source,
attr.TelemetrySDKLanguage,
}),
// hostID is not taken from the span but common to the metrics reporter,
// so the getter is injected here directly
Expand Down
3 changes: 2 additions & 1 deletion pkg/export/prom/prom.go
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ func appendK8sLabelValuesService(values []string, service *svc.Attrs) []string {
}

func labelNamesSpans() []string {
return []string{serviceNameKey, serviceNamespaceKey, spanNameKey, statusCodeKey, spanKindKey, serviceInstanceKey, serviceJobKey, sourceKey}
return []string{serviceNameKey, serviceNamespaceKey, spanNameKey, statusCodeKey, spanKindKey, serviceInstanceKey, serviceJobKey, sourceKey, telemetryLanguageKey}
}

func (r *metricsReporter) labelValuesSpans(span *request.Span) []string {
Expand All @@ -1050,6 +1050,7 @@ func (r *metricsReporter) labelValuesSpans(span *request.Span) []string {
span.Service.UID.Instance, // app instance ID
span.Service.Job(),
attr.VendorPrefix,
span.Service.SDKLanguage.String(),
}
}

Expand Down
Loading