diff --git a/schema/v1.0/ast/ast_schema.go b/schema/v1.0/ast/ast_schema.go index 6e93ca198c7..edf3db22f8d 100644 --- a/schema/v1.0/ast/ast_schema.go +++ b/schema/v1.0/ast/ast_schema.go @@ -36,26 +36,21 @@ type Schema struct { // VersionDef corresponds to a section representing one version under the "versions" // top-level key. type VersionDef struct { - All VersionOfAttributes - Resources VersionOfAttributes - Spans VersionOfSpans - SpanEvents VersionOfSpanEvents `yaml:"span_events"` - Logs VersionOfLogs - Metrics VersionOfMetrics + All Attributes + Resources Attributes + Spans Spans + SpanEvents SpanEvents `yaml:"span_events"` + Logs Logs + Metrics Metrics } -// VersionOfAttributes corresponds to a section representing a list of changes that +// Attributes corresponds to a section representing a list of changes that // happened in a particular version. -type VersionOfAttributes struct { +type Attributes struct { Changes []AttributeChanges } // AttributeChanges corresponds to a section representing attribute changes. type AttributeChanges struct { - RenameAttributes *MappingOfAttributes `yaml:"rename_attributes"` + RenameAttributes *AttributeMap `yaml:"rename_attributes"` } - -// MappingOfAttributes corresponds to a section representing a mapping of attribute names. -// The keys are the old attribute name used the previous version, the values are the -// new attribute name starting from this version. -type MappingOfAttributes map[string]string diff --git a/schema/v1.0/ast/common.go b/schema/v1.0/ast/common.go new file mode 100644 index 00000000000..7321454f679 --- /dev/null +++ b/schema/v1.0/ast/common.go @@ -0,0 +1,25 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ast // import "go.opentelemetry.io/otel/schema/v1.0/ast" + +// RenameAttributes corresponds to a section that describes attribute renaming. +type RenameAttributes struct { + AttributeMap AttributeMap `yaml:"attribute_map"` +} + +// AttributeMap corresponds to a section representing a mapping of attribute names. +// The keys are the old attribute name used in the previous version, the values are the +// new attribute name starting from this version. +type AttributeMap map[string]string diff --git a/schema/v1.0/ast/logs.go b/schema/v1.0/ast/logs.go index 193c1777018..b555b0c7b6b 100644 --- a/schema/v1.0/ast/logs.go +++ b/schema/v1.0/ast/logs.go @@ -14,17 +14,13 @@ package ast // import "go.opentelemetry.io/otel/schema/v1.0/ast" -// VersionOfLogs corresponds to a section representing a list of changes that happened +// Logs corresponds to a section representing a list of changes that happened // to logs schema in a particular version. -type VersionOfLogs struct { +type Logs struct { Changes []LogsChange } // LogsChange corresponds to a section representing logs change. type LogsChange struct { - RenameAttributes *RenameLogAttributes `yaml:"rename_attributes"` -} - -type RenameLogAttributes struct { - AttributeMap map[string]string `yaml:"attribute_map"` + RenameAttributes *RenameAttributes `yaml:"rename_attributes"` } diff --git a/schema/v1.0/ast/metrics.go b/schema/v1.0/ast/metrics.go index 6773351d14d..1cd97621411 100644 --- a/schema/v1.0/ast/metrics.go +++ b/schema/v1.0/ast/metrics.go @@ -16,19 +16,19 @@ package ast // import "go.opentelemetry.io/otel/schema/v1.0/ast" import "go.opentelemetry.io/otel/schema/v1.0/types" -// VersionOfMetrics corresponds to a section representing a list of changes that happened +// Metrics corresponds to a section representing a list of changes that happened // to metrics schema in a particular version. -type VersionOfMetrics struct { +type Metrics struct { Changes []MetricsChange } // MetricsChange corresponds to a section representing metrics change. type MetricsChange struct { - RenameMetrics map[types.MetricName]types.MetricName `yaml:"rename_metrics"` - RenameLabels *LabelMapForMetrics `yaml:"rename_labels"` + RenameMetrics map[types.MetricName]types.MetricName `yaml:"rename_metrics"` + RenameAttributes *AttributeMapForMetrics `yaml:"rename_labels"` } -type LabelMapForMetrics struct { +type AttributeMapForMetrics struct { ApplyToMetrics []types.MetricName `yaml:"apply_to_metrics"` - LabelMap map[string]string `yaml:"label_map"` + AttributeMap AttributeMap `yaml:"label_map"` } diff --git a/schema/v1.0/ast/spans.go b/schema/v1.0/ast/spans.go index ba0215de6d9..b5735ec5847 100644 --- a/schema/v1.0/ast/spans.go +++ b/schema/v1.0/ast/spans.go @@ -16,21 +16,21 @@ package ast // import "go.opentelemetry.io/otel/schema/v1.0/ast" import "go.opentelemetry.io/otel/schema/v1.0/types" -// VersionOfSpans corresponds to a section representing a list of changes that happened +// Spans corresponds to a section representing a list of changes that happened // to spans schema in a particular version. -type VersionOfSpans struct { +type Spans struct { Changes []SpansChange } -// VersionOfSpanEvents corresponds to a section representing a list of changes that happened +// SpanEvents corresponds to a section representing a list of changes that happened // to span events schema in a particular version. -type VersionOfSpanEvents struct { +type SpanEvents struct { Changes []SpanEventsChange } // SpansChange corresponds to a section representing spans change. type SpansChange struct { - RenameAttributes *RenameSpanAttributes `yaml:"rename_attributes"` + RenameAttributes *RenameAttributes `yaml:"rename_attributes"` } // SpanEventsChange corresponds to a section representing span events change. @@ -39,10 +39,6 @@ type SpanEventsChange struct { RenameAttributes *RenameSpanEventAttributes `yaml:"rename_attributes"` } -type RenameSpanAttributes struct { - AttributeMap map[string]string `yaml:"attribute_map"` -} - type RenameSpanEvents struct { EventNameMap map[string]string `yaml:"name_map"` } diff --git a/versions.yaml b/versions.yaml index 8b393bd8bb9..2abc0e07bae 100644 --- a/versions.yaml +++ b/versions.yaml @@ -45,6 +45,10 @@ module-sets: - go.opentelemetry.io/otel/metric - go.opentelemetry.io/otel/sdk/export/metric - go.opentelemetry.io/otel/sdk/metric + experimental-schema: + version: v0.0.1 + modules: + - go.opentelemetry.io/otel/schema bridge: version: v0.24.0 modules: