Plugins: Add tracing to pipeline (#115448)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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` |  |
|
||||
| `grafana.plugin.source.class` | string | The plugin source class. | `core` | `Recommended` |  |
|
||||
| `grafana.plugin.type` | string | The plugin type. | `datasource` | `Recommended` |  |
|
||||
<!-- endsemconv -->
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user