Debian Codegraph @

schema/v1.1/ast/metrics.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 package ast // import "go.opentelemetry.io/otel/schema/v1.1/ast"
5
6 import (
7 ast10 "go.opentelemetry.io/otel/schema/v1.0/ast"
8 types10 "go.opentelemetry.io/otel/schema/v1.0/types"
9 types11 "go.opentelemetry.io/otel/schema/v1.1/types"
10 )
11
12 // Metrics corresponds to a section representing a list of changes that happened
13 // to metrics schema in a particular version.
14 type Metrics struct {
15 Changes []MetricsChange
16 }
17
18 // MetricsChange corresponds to a section representing metrics change.
19 type MetricsChange struct {
20 RenameMetrics map[types10.MetricName]types10.MetricName `yaml:"rename_metrics"`
21 RenameAttributes *ast10.AttributeMapForMetrics `yaml:"rename_attributes"`
22 Split *SplitMetric `yaml:"split"`
23 }
24
25 // SplitMetric corresponds to a section representing a splitting of a metric
26 // into multiple metrics by eliminating an attribute.
27 // SplitMetrics is introduced in schema file format 1.1,
28 // see https://github.com/open-telemetry/opentelemetry-specification/pull/2653
29 type SplitMetric struct {
30 // Name of the old metric to split.
31 ApplyToMetric types10.MetricName `yaml:"apply_to_metric"`
32
33 // Name of attribute in the old metric to use for splitting. The attribute will be
34 // eliminated, the new metric will not have it.
35 ByAttribute types11.AttributeName `yaml:"by_attribute"`
36
37 // Names of new metrics to create, one for each possible value of attribute.
38 // map of key/values. The keys are the new metric name starting from this version,
39 // the values are old attribute value used in the previous version.
40 MetricsFromAttributes map[types10.MetricName]types11.AttributeValue `yaml:"metrics_from_attributes"`
41 }