Plugins: Add tracing to pipeline (#115448)

This commit is contained in:
Todd Treece
2025-12-17 09:08:17 -05:00
committed by GitHub
parent af85563527
commit 33e53db53a
13 changed files with 168 additions and 13 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ all: go markdown
.PHONY: go
go:
@docker run --rm -u 1000:1000 -v./model:/tmp/grafana/model -v./:/tmp/grafana/output -v./templates:/tmp/grafana/templates \
@docker run --rm --platform linux/amd64 -u 1000:1000 -v./model:/tmp/grafana/model -v./:/tmp/grafana/output -v./templates:/tmp/grafana/templates \
otel/semconvgen --yaml-root "/tmp/grafana/model/" \
code --template "/tmp/grafana/templates/template.j2" \
--output "/tmp/grafana/output/attributes.go"
@@ -11,7 +11,7 @@ go:
.PHONY: markdown
markdown:
@docker run --rm -u 1000:1000 -v./model:/tmp/grafana/model -v./:/tmp/grafana/output -v./templates:/tmp/grafana/templates \
@docker run --rm --platform linux/amd64 -u 1000:1000 -v./model:/tmp/grafana/model -v./:/tmp/grafana/output -v./templates:/tmp/grafana/templates \
otel/semconvgen --yaml-root "/tmp/grafana/model/" \
markdown --markdown-root "/tmp/grafana/output/"
@npx --yes -- markdown-toc --bullets "-" --no-first-h1 --no-stripHeadingTags -i README.md || exit 1
+1
View File
@@ -55,6 +55,7 @@ For more information:
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| `grafana.plugin.id` | string | The plugin ID. | `prometheus`; `loki`; `grafana-github-datasource` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| `grafana.plugin.source.class` | string | The plugin source class. | `core` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| `grafana.plugin.type` | string | The plugin type. | `datasource` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
<!-- endsemconv -->
+21
View File
@@ -140,6 +140,27 @@ func GrafanaPluginId(val string) attribute.KeyValue {
return grafanaPluginIdKey.String(val)
}
// Describes Grafana plugin source attributes.
const (
// GrafanaPluginSourceClassKey is the attribute Key conforming to the
// "grafana.plugin.source.class" semantic conventions. It represents the
// plugin source class.
//
// Type: Enum
// RequirementLevel: Optional
// Stability: stable
grafanaPluginSourceClassKey = attribute.Key("grafana.plugin.source.class")
)
var (
// Core Plugin
GrafanaPluginSourceClassCore = grafanaPluginSourceClassKey.String("core")
// External Plugin
GrafanaPluginSourceClassExternal = grafanaPluginSourceClassKey.String("external")
// Unknown Plugin Source
GrafanaPluginSourceClassUnknown = grafanaPluginSourceClassKey.String("unknown")
)
// Describes Grafana service attributes.
const (
// GrafanaServiceNameKey is the attribute Key conforming to the
+23
View File
@@ -34,3 +34,26 @@ groups:
brief: The plugin type.
examples: datasource
stability: stable
- id: registry.grafana.plugin.source
type: attribute_group
display_name: Grafana Plugin Source Attributes
brief: "Describes Grafana plugin source attributes."
attributes:
- id: grafana.plugin.source.class
type:
members:
- id: core
value: "core"
brief: 'Core Plugin'
stability: stable
- id: external
value: "external"
brief: 'External Plugin'
stability: stable
- id: unknown
value: "unknown"
brief: 'Unknown Plugin Source'
stability: stable
brief: The plugin source class.
stability: stable
+2 -1
View File
@@ -5,4 +5,5 @@ groups:
stability: stable
attributes:
- ref: grafana.plugin.id
- ref: grafana.plugin.type
- ref: grafana.plugin.type
- ref: grafana.plugin.source.class
+19
View File
@@ -0,0 +1,19 @@
package semconv
import (
"fmt"
"go.opentelemetry.io/otel/attribute"
)
// PluginSourceClass converts a plugin source class to the corresponding semantic convention attribute.
func PluginSourceClass(class fmt.Stringer) attribute.KeyValue {
switch class.String() {
case "core":
return GrafanaPluginSourceClassCore
case "external":
return GrafanaPluginSourceClassExternal
default:
return GrafanaPluginSourceClassUnknown
}
}