| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
// Package ast provides abstract syntax tree parsing for the OpenTelemetry |
| 5 |
// schema. |
| 6 |
package ast // import "go.opentelemetry.io/otel/schema/v1.1/ast" |
| 7 |
|
| 8 |
import ( |
| 9 |
ast10 "go.opentelemetry.io/otel/schema/v1.0/ast" |
| 10 |
"go.opentelemetry.io/otel/schema/v1.1/types" |
| 11 |
) |
| 12 |
|
| 13 |
// Schema represents a Schema file in FileFormat 1.1.0 as defined in |
| 14 |
// https://github.com/open-telemetry/oteps/blob/main/text/0152-telemetry-schemas.md |
| 15 |
type Schema struct { |
| 16 |
// Schema file format. SHOULD be 1.1.0 for the current specification version. |
| 17 |
// See https://github.com/open-telemetry/oteps/blob/main/text/0152-telemetry-schemas.md#schema-file-format-number |
| 18 |
FileFormat string `yaml:"file_format"` |
| 19 |
|
| 20 |
// Schema URL is an identifier of a Schema. The URL specifies a location of this |
| 21 |
// Schema File that can be retrieved (so it is a URL and not just a URI) using HTTP |
| 22 |
// or HTTPS protocol. |
| 23 |
// See https://github.com/open-telemetry/oteps/blob/main/text/0152-telemetry-schemas.md#schema-url |
| 24 |
SchemaURL string `yaml:"schema_url"` |
| 25 |
|
| 26 |
// Versions section that lists changes that happened in each particular version. |
| 27 |
Versions map[types.TelemetryVersion]VersionDef |
| 28 |
} |
| 29 |
|
| 30 |
// VersionDef corresponds to a section representing one version under the "versions" |
| 31 |
// top-level key. |
| 32 |
// Note that most of the fields are the same as in ast 1.0 package, only Metrics are defined |
| 33 |
// differently, since only that field has changed from 1.0 to 1.1 of schema file format. |
| 34 |
type VersionDef struct { |
| 35 |
All ast10.Attributes |
| 36 |
Resources ast10.Attributes |
| 37 |
Spans ast10.Spans |
| 38 |
SpanEvents ast10.SpanEvents `yaml:"span_events"` |
| 39 |
Logs ast10.Logs |
| 40 |
Metrics Metrics |
| 41 |
} |