From c5178807bed04797947c68906dbb2a835cf3d0e2 Mon Sep 17 00:00:00 2001 From: Todd Treece <360020+toddtreece@users.noreply.github.com> Date: Fri, 1 Nov 2024 18:29:14 -0400 Subject: [PATCH] Semconv: Add service name attribute (#95743) --- pkg/semconv/attributes.go | 19 +++++++++++++++++++ pkg/semconv/model/registry/service.yml | 12 ++++++++++++ pkg/semconv/model/trace/service.yaml | 7 +++++++ 3 files changed, 38 insertions(+) create mode 100644 pkg/semconv/model/registry/service.yml create mode 100644 pkg/semconv/model/trace/service.yaml diff --git a/pkg/semconv/attributes.go b/pkg/semconv/attributes.go index b69a20457ea..c05fd9f4e5b 100644 --- a/pkg/semconv/attributes.go +++ b/pkg/semconv/attributes.go @@ -4,6 +4,25 @@ package semconv import "go.opentelemetry.io/otel/attribute" +// Describes Grafana service attributes. +const ( + // GrafanaServiceNameKey is the attribute Key conforming to the + // "grafana.service.name" semantic conventions. It represents the service + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'grafana-apiserver' + grafanaServiceNameKey = attribute.Key("grafana.service.name") +) + +// GrafanaServiceName returns an attribute KeyValue conforming to the +// "grafana.service.name" semantic conventions. It represents the service name. +func GrafanaServiceName(val string) attribute.KeyValue { + return grafanaServiceNameKey.String(val) +} + // Describes Grafana datasource attributes. const ( // GrafanaDatasourceTypeKey is the attribute Key conforming to the diff --git a/pkg/semconv/model/registry/service.yml b/pkg/semconv/model/registry/service.yml new file mode 100644 index 00000000000..b85dd4663e2 --- /dev/null +++ b/pkg/semconv/model/registry/service.yml @@ -0,0 +1,12 @@ +groups: + - id: registry.grafana.service + type: attribute_group + display_name: Grafana Service Attributes + brief: "Describes Grafana service attributes." + attributes: + - id: grafana.service.name + type: string + brief: The service name. + examples: + - "grafana-apiserver" + stability: stable \ No newline at end of file diff --git a/pkg/semconv/model/trace/service.yaml b/pkg/semconv/model/trace/service.yaml new file mode 100644 index 00000000000..05670d292bf --- /dev/null +++ b/pkg/semconv/model/trace/service.yaml @@ -0,0 +1,7 @@ +groups: + - id: trace.grafana.service + type: span + brief: 'Semantic Convention for Grafana services' + stability: stable + attributes: + - ref: grafana.service.name \ No newline at end of file