You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-05-22 09:35:21 +02:00
Generate and upgrade to semconv/v1.41.0 (#8324)
Fix https://github.com/open-telemetry/opentelemetry-go/issues/8299 Relevant upstream v1.41.0 release notes: > ### 🛑 Breaking changes 🛑 > > - `graphql`: Change `graphql.document` attribute requirement level from Recommended to Opt-In due to sensitive data, cardinality, and size concerns ([#2985](https://github.com/open-telemetry/semantic-conventions/issues/2985)) > - `process`: Move process.executable to its own entity. ([#3535](https://github.com/open-telemetry/semantic-conventions/issues/3535)) > - `process`: Update requirement levels for process attributes to ensure consistent identification and description across platforms. ([#864](https://github.com/open-telemetry/semantic-conventions/issues/864)) > - `rpc`: Remove `client.address` and `client.port` attributes from RPC server spans. ([#3487](https://github.com/open-telemetry/semantic-conventions/issues/3487), [#3488](https://github.com/open-telemetry/semantic-conventions/issues/3488)) > > ### 💡 Enhancements 💡 > > - `Go`: Add opt-in go.memory.gc.pause.duration histogram metric. ([#3353](https://github.com/open-telemetry/semantic-conventions/issues/3353)) > - `deployment`: Stabilize `deployment.environment.name` attribute. ([#3339](https://github.com/open-telemetry/semantic-conventions/issues/3339)) > - `deployment`: Add enum values for `deployment.environment.name` attribute. ([#2910](https://github.com/open-telemetry/semantic-conventions/issues/2910)) > - `go`: Add the go.cpu.time opt-in metric, and add go.cpu.detailed_state and go.memory.detailed_type attributes to CPU and memory metrics respectively with wildcard values. ([#3354](https://github.com/open-telemetry/semantic-conventions/issues/3354)) > - `go`: Add the opt-in go.memory.gc.cycles metric. ([#3353](https://github.com/open-telemetry/semantic-conventions/issues/3353)) > - `telemetry`: Promote `telemetry.distro.name` and `telemetry.distro.version` attributes to 'stable'. ([#3650](https://github.com/open-telemetry/semantic-conventions/issues/3650)) This PR also: - fixes semconv migration generation to ignore unexported declarations when computing renames/removals - upgrades repo imports, depguard, docs, templates, and schema URL expectations to `go.opentelemetry.io/otel/semconv/v1.41.0` - adds missing generated-file headers to semconvkit templates and regenerates the affected `v1.41.0` files via `TAG="v1.41.0" make semconv-generate` --------- Co-authored-by: David Ashpole <dashpole@google.com>
This commit is contained in:
+2
-2
@@ -96,9 +96,9 @@ linters:
|
||||
- "!**/exporters/zipkin/**"
|
||||
deny:
|
||||
- pkg: go.opentelemetry.io/otel/semconv
|
||||
desc: "Use go.opentelemetry.io/otel/semconv/v1.40.0 instead. If a newer semconv version has been released, update the depguard rule."
|
||||
desc: "Use go.opentelemetry.io/otel/semconv/v1.41.0 instead. If a newer semconv version has been released, update the depguard rule."
|
||||
allow:
|
||||
- go.opentelemetry.io/otel/semconv/v1.40.0
|
||||
- go.opentelemetry.io/otel/semconv/v1.41.0
|
||||
gocritic:
|
||||
disabled-checks:
|
||||
- appendAssign
|
||||
|
||||
@@ -38,6 +38,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
- Add `WithDefaultAttributes` to `go.opentelemetry.io/otel/metric/x` to support setting default attributes on instruments. (#8135)
|
||||
- Add `Settable` to `go.opentelemetry.io/otel/metric/x` to allow reusing attribute options. (#8178)
|
||||
- Add experimental self-observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#8194)
|
||||
- Add `go.opentelemetry.io/otel/semconv/v1.41.0` package.
|
||||
The package contains semantic conventions from the `v1.41.0` version of the OpenTelemetry Semantic Conventions.
|
||||
See the [migration documentation](./semconv/v1.41.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.40.0`. (#8324)
|
||||
|
||||
### Changed
|
||||
|
||||
|
||||
+3
-3
@@ -752,8 +752,8 @@ Encapsulate setup in constructor functions, ensuring clear ownership and scope:
|
||||
import (
|
||||
"errors"
|
||||
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
type SDKComponent struct {
|
||||
@@ -1054,7 +1054,7 @@ func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan)
|
||||
|
||||
All observability metrics should follow the [OpenTelemetry Semantic Conventions for SDK metrics](https://github.com/open-telemetry/semantic-conventions/blob/1cf2476ae5e518225a766990a28a6d5602bd5a30/docs/otel/sdk-metrics.md).
|
||||
|
||||
Use the metric semantic conventions convenience package [otelconv](./semconv/v1.40.0/otelconv/metric.go).
|
||||
Use the metric semantic conventions convenience package [otelconv](./semconv/v1.41.0/otelconv/metric.go).
|
||||
|
||||
##### Component Identification
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/bridge/opentracing/migration"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.opentelemetry.io/otel/trace/embedded"
|
||||
"go.opentelemetry.io/otel/trace/noop"
|
||||
|
||||
@@ -37,8 +37,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -21,8 +21,8 @@ import (
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc/internal/x"
|
||||
"go.opentelemetry.io/otel/internal/global"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -19,8 +19,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/log"
|
||||
"go.opentelemetry.io/otel/sdk/log/logtest"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -21,8 +21,8 @@ import (
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp/internal/x"
|
||||
"go.opentelemetry.io/otel/internal/global"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -23,8 +23,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/log"
|
||||
"go.opentelemetry.io/otel/sdk/log/logtest"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1"
|
||||
cpb "go.opentelemetry.io/proto/otlp/common/v1"
|
||||
mpb "go.opentelemetry.io/proto/otlp/metrics/v1"
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
cpb "go.opentelemetry.io/proto/otlp/common/v1"
|
||||
mpb "go.opentelemetry.io/proto/otlp/metrics/v1"
|
||||
rpb "go.opentelemetry.io/proto/otlp/resource/v1"
|
||||
|
||||
@@ -36,8 +36,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
type clientShim struct {
|
||||
|
||||
@@ -25,8 +25,8 @@ import (
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/x"
|
||||
"go.opentelemetry.io/otel/internal/global"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -26,8 +26,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1"
|
||||
cpb "go.opentelemetry.io/proto/otlp/common/v1"
|
||||
mpb "go.opentelemetry.io/proto/otlp/metrics/v1"
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
cpb "go.opentelemetry.io/proto/otlp/common/v1"
|
||||
mpb "go.opentelemetry.io/proto/otlp/metrics/v1"
|
||||
rpb "go.opentelemetry.io/proto/otlp/resource/v1"
|
||||
|
||||
@@ -24,7 +24,7 @@ When enabled, the exporter will create the following metrics using the global `M
|
||||
|
||||
Please see the [Semantic conventions for OpenTelemetry SDK metrics] documentation for more details on these metrics.
|
||||
|
||||
[Semantic conventions for OpenTelemetry SDK metrics]: https://github.com/open-telemetry/semantic-conventions/blob/v1.40.0/docs/otel/sdk-metrics.md
|
||||
[Semantic conventions for OpenTelemetry SDK metrics]: https://github.com/open-telemetry/semantic-conventions/blob/v1.41.0/docs/otel/sdk-metrics.md
|
||||
|
||||
## Compatibility and Stability
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
tracesdk "go.opentelemetry.io/otel/sdk/trace"
|
||||
"go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||
"go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
||||
@@ -18,8 +18,8 @@ import (
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x"
|
||||
"go.opentelemetry.io/otel/internal/global"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -22,8 +22,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -36,7 +36,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
"go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -23,8 +23,8 @@ import (
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/x"
|
||||
"go.opentelemetry.io/otel/internal/global"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -24,8 +24,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
otelprom "go.opentelemetry.io/otel/exporters/prometheus"
|
||||
otelmetric "go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
func Example() {
|
||||
@@ -78,7 +78,7 @@ func Example() {
|
||||
// Output:
|
||||
// # HELP bar_total a simple counter
|
||||
// # TYPE bar_total counter
|
||||
// bar_total{otel_scope_name="example-global",otel_scope_schema_url="https://opentelemetry.io/schemas/1.40.0",otel_scope_version="v1.0.0"} 10
|
||||
// bar_total{otel_scope_name="example-global",otel_scope_schema_url="https://opentelemetry.io/schemas/1.41.0",otel_scope_version="v1.0.0"} 10
|
||||
}
|
||||
|
||||
func Example_customRegistry() {
|
||||
@@ -135,7 +135,7 @@ func Example_customRegistry() {
|
||||
// Output:
|
||||
// # HELP foo_total another counter
|
||||
// # TYPE foo_total counter
|
||||
// foo_total{otel_scope_name="example-custom",otel_scope_schema_url="https://opentelemetry.io/schemas/1.40.0",otel_scope_version="v1.0.0"} 5
|
||||
// foo_total{otel_scope_name="example-custom",otel_scope_schema_url="https://opentelemetry.io/schemas/1.41.0",otel_scope_version="v1.0.0"} 5
|
||||
}
|
||||
|
||||
func Example_noTranslation() {
|
||||
@@ -198,5 +198,5 @@ func Example_noTranslation() {
|
||||
// Output:
|
||||
// # HELP "my.metric" a counter without translation
|
||||
// # TYPE "my.metric" counter
|
||||
// {"my.metric",otel_scope_name="example-no-translation",otel_scope_schema_url="https://opentelemetry.io/schemas/1.40.0",otel_scope_version="v1.0.0"} 5
|
||||
// {"my.metric",otel_scope_name="example-no-translation",otel_scope_schema_url="https://opentelemetry.io/schemas/1.41.0",otel_scope_version="v1.0.0"} 5
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ import (
|
||||
"go.opentelemetry.io/otel/exporters/prometheus/internal"
|
||||
"go.opentelemetry.io/otel/exporters/prometheus/internal/x"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -18,8 +18,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const ID = 0
|
||||
|
||||
@@ -18,8 +18,8 @@ import (
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/exporters/stdout/stdoutlog/internal"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -13,13 +13,13 @@ import (
|
||||
"go.opentelemetry.io/otel/exporters/stdout/stdoutlog/internal"
|
||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -26,8 +26,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
func testEncoderOption() stdoutmetric.Option {
|
||||
|
||||
@@ -17,8 +17,8 @@ import (
|
||||
"go.opentelemetry.io/otel/exporters/stdout/stdoutmetric/internal"
|
||||
"go.opentelemetry.io/otel/exporters/stdout/stdoutmetric/internal/x"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -18,8 +18,8 @@ import (
|
||||
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
type testSetup struct {
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ import (
|
||||
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace/internal"
|
||||
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace/internal/x"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -18,8 +18,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const ID = 0
|
||||
|
||||
@@ -28,8 +28,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
tracesdk "go.opentelemetry.io/otel/sdk/trace"
|
||||
"go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
semconv121 "go.opentelemetry.io/otel/semconv/v1.21.0"
|
||||
semconv125 "go.opentelemetry.io/otel/semconv/v1.25.0"
|
||||
semconv138 "go.opentelemetry.io/otel/semconv/v1.38.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||
semconv125 "go.opentelemetry.io/otel/semconv/v1.25.0"
|
||||
semconv138 "go.opentelemetry.io/otel/semconv/v1.38.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||
"go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/log"
|
||||
"go.opentelemetry.io/otel/sdk/log/logtest"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"{{ .internalImportPath }}"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1"
|
||||
cpb "go.opentelemetry.io/proto/otlp/common/v1"
|
||||
mpb "go.opentelemetry.io/proto/otlp/metrics/v1"
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
cpb "go.opentelemetry.io/proto/otlp/common/v1"
|
||||
mpb "go.opentelemetry.io/proto/otlp/metrics/v1"
|
||||
rpb "go.opentelemetry.io/proto/otlp/resource/v1"
|
||||
|
||||
@@ -245,13 +245,17 @@ func parse(d ast.Decl) []string {
|
||||
var out []string
|
||||
switch decl := d.(type) {
|
||||
case *ast.FuncDecl:
|
||||
out = []string{decl.Name.Name}
|
||||
if decl.Name.IsExported() {
|
||||
out = []string{decl.Name.Name}
|
||||
}
|
||||
case *ast.GenDecl:
|
||||
if decl.Tok == token.CONST || decl.Tok == token.VAR {
|
||||
for _, spec := range decl.Specs {
|
||||
if valueSpec, ok := spec.(*ast.ValueSpec); ok {
|
||||
for _, name := range valueSpec.Names {
|
||||
out = append(out, name.Name)
|
||||
if name.IsExported() {
|
||||
out = append(out, name.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewMigrationIgnoresUnexportedDeclarations(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
root := t.TempDir()
|
||||
prev := filepath.Join(root, "v1.40.0")
|
||||
cur := filepath.Join(root, "v1.41.0")
|
||||
|
||||
writeGoFile(t, prev, "semconv", `package semconv
|
||||
|
||||
func ErrorType(err error) {}
|
||||
func DeploymentEnvironmentName(val string) {}
|
||||
`)
|
||||
writeGoFile(t, cur, "semconv", `package semconv
|
||||
|
||||
func ErrorType(err error) {}
|
||||
func errorType(err error) {}
|
||||
`)
|
||||
|
||||
m, err := newMigration(cur, prev)
|
||||
if err != nil {
|
||||
t.Fatalf("newMigration() error = %v", err)
|
||||
}
|
||||
|
||||
if len(m.Renames) != 0 {
|
||||
t.Fatalf("newMigration() renames = %#v, want none", m.Renames)
|
||||
}
|
||||
|
||||
wantRemoval := []string{"DeploymentEnvironmentName"}
|
||||
if len(m.Removals) != len(wantRemoval) || m.Removals[0] != wantRemoval[0] {
|
||||
t.Fatalf("newMigration() removals = %#v, want %#v", m.Removals, wantRemoval)
|
||||
}
|
||||
}
|
||||
|
||||
func writeGoFile(t *testing.T, dir, pkg, src string) {
|
||||
t.Helper()
|
||||
|
||||
if err := os.MkdirAll(dir, 0o755); err != nil {
|
||||
t.Fatalf("MkdirAll(%q) error = %v", dir, err)
|
||||
}
|
||||
|
||||
path := filepath.Join(dir, "decls.go")
|
||||
if err := os.WriteFile(path, []byte(src), 0o644); err != nil {
|
||||
t.Fatalf("WriteFile(%q) error = %v", path, err)
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
// Code generated from semantic convention specification. DO NOT EDIT.
|
||||
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Code generated from semantic convention specification. DO NOT EDIT.
|
||||
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Code generated from semantic convention specification. DO NOT EDIT.
|
||||
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Code generated from semantic convention specification. DO NOT EDIT.
|
||||
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Code generated from semantic convention specification. DO NOT EDIT.
|
||||
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
var meter = otel.Meter("my-service-meter")
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/sdk"
|
||||
"go.opentelemetry.io/otel/sdk/log/internal/x"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
// newRecordCounterIncr returns a function that increments the log record
|
||||
|
||||
@@ -14,8 +14,8 @@ import (
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/sdk"
|
||||
"go.opentelemetry.io/otel/sdk/log/internal/x"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -20,8 +20,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
func TestNextExporterID(t *testing.T) {
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import (
|
||||
"go.opentelemetry.io/otel/log"
|
||||
"go.opentelemetry.io/otel/log/embedded"
|
||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
func BenchmarkLoggerEmit(b *testing.B) {
|
||||
|
||||
@@ -24,8 +24,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
type exporter struct {
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/exemplar"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
// To enable metrics in your application using the SDK,
|
||||
|
||||
@@ -16,8 +16,8 @@ import (
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/sdk"
|
||||
"go.opentelemetry.io/otel/sdk/internal/x"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -19,8 +19,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric/internal/observ"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
func TestManualReader(t *testing.T) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric/internal/observ"
|
||||
"go.opentelemetry.io/otel/sdk/metric/internal/x"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
// Default periodic reader timing.
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const testDur = time.Second * 2
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/sdk"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
type (
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"os"
|
||||
"regexp"
|
||||
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
type containerIDProvider func() (string, error)
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
func TestDetectOnePair(t *testing.T) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
type hostIDProvider func() (string, error)
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
type osDescriptionProvider func() (string, error)
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
func mockRuntimeProviders() {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
type (
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
func TestDefaultExperimental(t *testing.T) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/sdk"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -26,8 +26,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
"go.opentelemetry.io/otel/sdk/trace/internal/env"
|
||||
"go.opentelemetry.io/otel/sdk/trace/internal/observ"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ import (
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/sdk"
|
||||
"go.opentelemetry.io/otel/sdk/internal/x"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -15,8 +15,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/trace/internal/observ"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
const id = 0
|
||||
|
||||
@@ -13,8 +13,8 @@ import (
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/sdk"
|
||||
"go.opentelemetry.io/otel/sdk/internal/x"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
var measureAttrsPool = sync.Pool{
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric/noop"
|
||||
"go.opentelemetry.io/otel/sdk/trace/internal/observ"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
)
|
||||
|
||||
const sspComponentID = 0
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/sdk"
|
||||
"go.opentelemetry.io/otel/sdk/internal/x"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/trace"
|
||||
"go.opentelemetry.io/otel/sdk/trace/internal/observ"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
tapi "go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
)
|
||||
|
||||
type simpleTestExporter struct {
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ import (
|
||||
"go.opentelemetry.io/otel/internal/global"
|
||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.opentelemetry.io/otel/trace/embedded"
|
||||
)
|
||||
|
||||
@@ -29,8 +29,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
"go.opentelemetry.io/otel/sdk/trace/internal/observ"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.41.0/otelconv"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<!-- Generated. DO NOT MODIFY. -->
|
||||
# Migration from v1.40.0 to v1.41.0
|
||||
|
||||
The `go.opentelemetry.io/otel/semconv/v1.41.0` package should be a drop-in replacement for `go.opentelemetry.io/otel/semconv/v1.40.0` with the following exceptions.
|
||||
|
||||
## Removed
|
||||
|
||||
The following declarations have been removed.
|
||||
Refer to the [OpenTelemetry Semantic Conventions documentation] for deprecation instructions.
|
||||
|
||||
If the type is not listed in the documentation as deprecated, it has been removed in this version due to lack of applicability or use.
|
||||
If you use any of these non-deprecated declarations in your Go application, please [open an issue] describing your use-case.
|
||||
|
||||
- `DeploymentEnvironmentName`
|
||||
|
||||
[OpenTelemetry Semantic Conventions documentation]: https://github.com/open-telemetry/semantic-conventions
|
||||
[open an issue]: https://github.com/open-telemetry/opentelemetry-go/issues/new?template=Blank+issue
|
||||
@@ -0,0 +1,3 @@
|
||||
# Semconv v1.41.0
|
||||
|
||||
[](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.41.0)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,364 @@
|
||||
// Code generated from semantic convention specification. DO NOT EDIT.
|
||||
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package azureconv provides types and functionality for OpenTelemetry semantic
|
||||
// conventions in the "azure" namespace.
|
||||
package azureconv
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/metric/noop"
|
||||
)
|
||||
|
||||
var (
|
||||
addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }}
|
||||
recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }}
|
||||
)
|
||||
|
||||
// CosmosDBConsistencyLevelAttr is an attribute conforming to the
|
||||
// azure.cosmosdb.consistency.level semantic conventions. It represents the
|
||||
// account or request [consistency level].
|
||||
//
|
||||
// [consistency level]: https://learn.microsoft.com/azure/cosmos-db/consistency-levels
|
||||
type CosmosDBConsistencyLevelAttr string
|
||||
|
||||
var (
|
||||
// CosmosDBConsistencyLevelStrong is the strong.
|
||||
CosmosDBConsistencyLevelStrong CosmosDBConsistencyLevelAttr = "Strong"
|
||||
// CosmosDBConsistencyLevelBoundedStaleness is the bounded Staleness.
|
||||
CosmosDBConsistencyLevelBoundedStaleness CosmosDBConsistencyLevelAttr = "BoundedStaleness"
|
||||
// CosmosDBConsistencyLevelSession is the session.
|
||||
CosmosDBConsistencyLevelSession CosmosDBConsistencyLevelAttr = "Session"
|
||||
// CosmosDBConsistencyLevelEventual is the eventual.
|
||||
CosmosDBConsistencyLevelEventual CosmosDBConsistencyLevelAttr = "Eventual"
|
||||
// CosmosDBConsistencyLevelConsistentPrefix is the consistent Prefix.
|
||||
CosmosDBConsistencyLevelConsistentPrefix CosmosDBConsistencyLevelAttr = "ConsistentPrefix"
|
||||
)
|
||||
|
||||
// ErrorTypeAttr is an attribute conforming to the error.type semantic
|
||||
// conventions. It represents the describes a class of error the operation ended
|
||||
// with.
|
||||
type ErrorTypeAttr string
|
||||
|
||||
var (
|
||||
// ErrorTypeOther is a fallback error value to be used when the instrumentation
|
||||
// doesn't define a custom value.
|
||||
ErrorTypeOther ErrorTypeAttr = "_OTHER"
|
||||
)
|
||||
|
||||
// CosmosDBClientActiveInstanceCount is an instrument used to record metric
|
||||
// values conforming to the "azure.cosmosdb.client.active_instance.count"
|
||||
// semantic conventions. It represents the number of active client instances.
|
||||
type CosmosDBClientActiveInstanceCount struct {
|
||||
metric.Int64UpDownCounter
|
||||
}
|
||||
|
||||
var newCosmosDBClientActiveInstanceCountOpts = []metric.Int64UpDownCounterOption{
|
||||
metric.WithDescription("Number of active client instances."),
|
||||
metric.WithUnit("{instance}"),
|
||||
}
|
||||
|
||||
// NewCosmosDBClientActiveInstanceCount returns a new
|
||||
// CosmosDBClientActiveInstanceCount instrument.
|
||||
func NewCosmosDBClientActiveInstanceCount(
|
||||
m metric.Meter,
|
||||
opt ...metric.Int64UpDownCounterOption,
|
||||
) (CosmosDBClientActiveInstanceCount, error) {
|
||||
// Check if the meter is nil.
|
||||
if m == nil {
|
||||
return CosmosDBClientActiveInstanceCount{noop.Int64UpDownCounter{}}, nil
|
||||
}
|
||||
|
||||
if len(opt) == 0 {
|
||||
opt = newCosmosDBClientActiveInstanceCountOpts
|
||||
} else {
|
||||
opt = append(opt, newCosmosDBClientActiveInstanceCountOpts...)
|
||||
}
|
||||
|
||||
i, err := m.Int64UpDownCounter(
|
||||
"azure.cosmosdb.client.active_instance.count",
|
||||
opt...,
|
||||
)
|
||||
if err != nil {
|
||||
return CosmosDBClientActiveInstanceCount{noop.Int64UpDownCounter{}}, err
|
||||
}
|
||||
return CosmosDBClientActiveInstanceCount{i}, nil
|
||||
}
|
||||
|
||||
// Inst returns the underlying metric instrument.
|
||||
func (m CosmosDBClientActiveInstanceCount) Inst() metric.Int64UpDownCounter {
|
||||
return m.Int64UpDownCounter
|
||||
}
|
||||
|
||||
// Name returns the semantic convention name of the instrument.
|
||||
func (CosmosDBClientActiveInstanceCount) Name() string {
|
||||
return "azure.cosmosdb.client.active_instance.count"
|
||||
}
|
||||
|
||||
// Unit returns the semantic convention unit of the instrument
|
||||
func (CosmosDBClientActiveInstanceCount) Unit() string {
|
||||
return "{instance}"
|
||||
}
|
||||
|
||||
// Description returns the semantic convention description of the instrument
|
||||
func (CosmosDBClientActiveInstanceCount) Description() string {
|
||||
return "Number of active client instances."
|
||||
}
|
||||
|
||||
// Add adds incr to the existing count for attrs.
|
||||
//
|
||||
// All additional attrs passed are included in the recorded value.
|
||||
func (m CosmosDBClientActiveInstanceCount) Add(
|
||||
ctx context.Context,
|
||||
incr int64,
|
||||
attrs ...attribute.KeyValue,
|
||||
) {
|
||||
if !m.Int64UpDownCounter.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if len(attrs) == 0 {
|
||||
m.Int64UpDownCounter.Add(ctx, incr)
|
||||
return
|
||||
}
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(
|
||||
*o,
|
||||
metric.WithAttributes(
|
||||
attrs...,
|
||||
),
|
||||
)
|
||||
|
||||
m.Int64UpDownCounter.Add(ctx, incr, *o...)
|
||||
}
|
||||
|
||||
// AddSet adds incr to the existing count for set.
|
||||
func (m CosmosDBClientActiveInstanceCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
|
||||
if !m.Int64UpDownCounter.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if set.Len() == 0 {
|
||||
m.Int64UpDownCounter.Add(ctx, incr)
|
||||
return
|
||||
}
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(*o, metric.WithAttributeSet(set))
|
||||
m.Int64UpDownCounter.Add(ctx, incr, *o...)
|
||||
}
|
||||
|
||||
// AttrServerPort returns an optional attribute for the "server.port" semantic
|
||||
// convention. It represents the server port number.
|
||||
func (CosmosDBClientActiveInstanceCount) AttrServerPort(val int) attribute.KeyValue {
|
||||
return attribute.Int("server.port", val)
|
||||
}
|
||||
|
||||
// AttrServerAddress returns an optional attribute for the "server.address"
|
||||
// semantic convention. It represents the name of the database host.
|
||||
func (CosmosDBClientActiveInstanceCount) AttrServerAddress(val string) attribute.KeyValue {
|
||||
return attribute.String("server.address", val)
|
||||
}
|
||||
|
||||
// CosmosDBClientOperationRequestCharge is an instrument used to record metric
|
||||
// values conforming to the "azure.cosmosdb.client.operation.request_charge"
|
||||
// semantic conventions. It represents the [Request units] consumed by the
|
||||
// operation.
|
||||
//
|
||||
// [Request units]: https://learn.microsoft.com/azure/cosmos-db/request-units
|
||||
type CosmosDBClientOperationRequestCharge struct {
|
||||
metric.Int64Histogram
|
||||
}
|
||||
|
||||
var newCosmosDBClientOperationRequestChargeOpts = []metric.Int64HistogramOption{
|
||||
metric.WithDescription("[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation."),
|
||||
metric.WithUnit("{request_unit}"),
|
||||
}
|
||||
|
||||
// NewCosmosDBClientOperationRequestCharge returns a new
|
||||
// CosmosDBClientOperationRequestCharge instrument.
|
||||
func NewCosmosDBClientOperationRequestCharge(
|
||||
m metric.Meter,
|
||||
opt ...metric.Int64HistogramOption,
|
||||
) (CosmosDBClientOperationRequestCharge, error) {
|
||||
// Check if the meter is nil.
|
||||
if m == nil {
|
||||
return CosmosDBClientOperationRequestCharge{noop.Int64Histogram{}}, nil
|
||||
}
|
||||
|
||||
if len(opt) == 0 {
|
||||
opt = newCosmosDBClientOperationRequestChargeOpts
|
||||
} else {
|
||||
opt = append(opt, newCosmosDBClientOperationRequestChargeOpts...)
|
||||
}
|
||||
|
||||
i, err := m.Int64Histogram(
|
||||
"azure.cosmosdb.client.operation.request_charge",
|
||||
opt...,
|
||||
)
|
||||
if err != nil {
|
||||
return CosmosDBClientOperationRequestCharge{noop.Int64Histogram{}}, err
|
||||
}
|
||||
return CosmosDBClientOperationRequestCharge{i}, nil
|
||||
}
|
||||
|
||||
// Inst returns the underlying metric instrument.
|
||||
func (m CosmosDBClientOperationRequestCharge) Inst() metric.Int64Histogram {
|
||||
return m.Int64Histogram
|
||||
}
|
||||
|
||||
// Name returns the semantic convention name of the instrument.
|
||||
func (CosmosDBClientOperationRequestCharge) Name() string {
|
||||
return "azure.cosmosdb.client.operation.request_charge"
|
||||
}
|
||||
|
||||
// Unit returns the semantic convention unit of the instrument
|
||||
func (CosmosDBClientOperationRequestCharge) Unit() string {
|
||||
return "{request_unit}"
|
||||
}
|
||||
|
||||
// Description returns the semantic convention description of the instrument
|
||||
func (CosmosDBClientOperationRequestCharge) Description() string {
|
||||
return "[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation."
|
||||
}
|
||||
|
||||
// Record records val to the current distribution for attrs.
|
||||
//
|
||||
// The dbOperationName is the the name of the operation or command being
|
||||
// executed.
|
||||
//
|
||||
// All additional attrs passed are included in the recorded value.
|
||||
func (m CosmosDBClientOperationRequestCharge) Record(
|
||||
ctx context.Context,
|
||||
val int64,
|
||||
dbOperationName string,
|
||||
attrs ...attribute.KeyValue,
|
||||
) {
|
||||
if !m.Int64Histogram.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if len(attrs) == 0 {
|
||||
m.Int64Histogram.Record(ctx, val, metric.WithAttributes(
|
||||
attribute.String("db.operation.name", dbOperationName),
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
o := recOptPool.Get().(*[]metric.RecordOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
recOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(
|
||||
*o,
|
||||
metric.WithAttributes(
|
||||
append(
|
||||
attrs[:len(attrs):len(attrs)],
|
||||
attribute.String("db.operation.name", dbOperationName),
|
||||
)...,
|
||||
),
|
||||
)
|
||||
|
||||
m.Int64Histogram.Record(ctx, val, *o...)
|
||||
}
|
||||
|
||||
// RecordSet records val to the current distribution for set.
|
||||
func (m CosmosDBClientOperationRequestCharge) RecordSet(ctx context.Context, val int64, set attribute.Set) {
|
||||
if !m.Int64Histogram.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if set.Len() == 0 {
|
||||
m.Int64Histogram.Record(ctx, val)
|
||||
return
|
||||
}
|
||||
|
||||
o := recOptPool.Get().(*[]metric.RecordOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
recOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(*o, metric.WithAttributeSet(set))
|
||||
m.Int64Histogram.Record(ctx, val, *o...)
|
||||
}
|
||||
|
||||
// AttrCosmosDBConsistencyLevel returns an optional attribute for the
|
||||
// "azure.cosmosdb.consistency.level" semantic convention. It represents the
|
||||
// account or request [consistency level].
|
||||
//
|
||||
// [consistency level]: https://learn.microsoft.com/azure/cosmos-db/consistency-levels
|
||||
func (CosmosDBClientOperationRequestCharge) AttrCosmosDBConsistencyLevel(val CosmosDBConsistencyLevelAttr) attribute.KeyValue {
|
||||
return attribute.String("azure.cosmosdb.consistency.level", string(val))
|
||||
}
|
||||
|
||||
// AttrCosmosDBResponseSubStatusCode returns an optional attribute for the
|
||||
// "azure.cosmosdb.response.sub_status_code" semantic convention. It represents
|
||||
// the cosmos DB sub status code.
|
||||
func (CosmosDBClientOperationRequestCharge) AttrCosmosDBResponseSubStatusCode(val int) attribute.KeyValue {
|
||||
return attribute.Int("azure.cosmosdb.response.sub_status_code", val)
|
||||
}
|
||||
|
||||
// AttrDBCollectionName returns an optional attribute for the
|
||||
// "db.collection.name" semantic convention. It represents the cosmos DB
|
||||
// container name.
|
||||
func (CosmosDBClientOperationRequestCharge) AttrDBCollectionName(val string) attribute.KeyValue {
|
||||
return attribute.String("db.collection.name", val)
|
||||
}
|
||||
|
||||
// AttrDBNamespace returns an optional attribute for the "db.namespace" semantic
|
||||
// convention. It represents the name of the database, fully qualified within the
|
||||
// server address and port.
|
||||
func (CosmosDBClientOperationRequestCharge) AttrDBNamespace(val string) attribute.KeyValue {
|
||||
return attribute.String("db.namespace", val)
|
||||
}
|
||||
|
||||
// AttrDBResponseStatusCode returns an optional attribute for the
|
||||
// "db.response.status_code" semantic convention. It represents the database
|
||||
// response status code.
|
||||
func (CosmosDBClientOperationRequestCharge) AttrDBResponseStatusCode(val string) attribute.KeyValue {
|
||||
return attribute.String("db.response.status_code", val)
|
||||
}
|
||||
|
||||
// AttrErrorType returns an optional attribute for the "error.type" semantic
|
||||
// convention. It represents the describes a class of error the operation ended
|
||||
// with.
|
||||
func (CosmosDBClientOperationRequestCharge) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue {
|
||||
return attribute.String("error.type", string(val))
|
||||
}
|
||||
|
||||
// AttrServerPort returns an optional attribute for the "server.port" semantic
|
||||
// convention. It represents the server port number.
|
||||
func (CosmosDBClientOperationRequestCharge) AttrServerPort(val int) attribute.KeyValue {
|
||||
return attribute.Int("server.port", val)
|
||||
}
|
||||
|
||||
// AttrCosmosDBOperationContactedRegions returns an optional attribute for the
|
||||
// "azure.cosmosdb.operation.contacted_regions" semantic convention. It
|
||||
// represents the list of regions contacted during operation in the order that
|
||||
// they were contacted. If there is more than one region listed, it indicates
|
||||
// that the operation was performed on multiple regions i.e. cross-regional call.
|
||||
func (CosmosDBClientOperationRequestCharge) AttrCosmosDBOperationContactedRegions(val ...string) attribute.KeyValue {
|
||||
return attribute.StringSlice("azure.cosmosdb.operation.contacted_regions", val)
|
||||
}
|
||||
|
||||
// AttrServerAddress returns an optional attribute for the "server.address"
|
||||
// semantic convention. It represents the name of the database host.
|
||||
func (CosmosDBClientOperationRequestCharge) AttrServerAddress(val string) attribute.KeyValue {
|
||||
return attribute.String("server.address", val)
|
||||
}
|
||||
@@ -0,0 +1,728 @@
|
||||
// Code generated from semantic convention specification. DO NOT EDIT.
|
||||
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package cicdconv provides types and functionality for OpenTelemetry semantic
|
||||
// conventions in the "cicd" namespace.
|
||||
package cicdconv
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/metric/noop"
|
||||
)
|
||||
|
||||
var (
|
||||
addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }}
|
||||
recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }}
|
||||
)
|
||||
|
||||
// PipelineResultAttr is an attribute conforming to the cicd.pipeline.result
|
||||
// semantic conventions. It represents the result of a pipeline run.
|
||||
type PipelineResultAttr string
|
||||
|
||||
var (
|
||||
// PipelineResultSuccess is the pipeline run finished successfully.
|
||||
PipelineResultSuccess PipelineResultAttr = "success"
|
||||
// PipelineResultFailure is the pipeline run did not finish successfully, eg.
|
||||
// due to a compile error or a failing test. Such failures are usually detected
|
||||
// by non-zero exit codes of the tools executed in the pipeline run.
|
||||
PipelineResultFailure PipelineResultAttr = "failure"
|
||||
// PipelineResultError is the pipeline run failed due to an error in the CICD
|
||||
// system, eg. due to the worker being killed.
|
||||
PipelineResultError PipelineResultAttr = "error"
|
||||
// PipelineResultTimeout is a timeout caused the pipeline run to be interrupted.
|
||||
PipelineResultTimeout PipelineResultAttr = "timeout"
|
||||
// PipelineResultCancellation is the pipeline run was cancelled, eg. by a user
|
||||
// manually cancelling the pipeline run.
|
||||
PipelineResultCancellation PipelineResultAttr = "cancellation"
|
||||
// PipelineResultSkip is the pipeline run was skipped, eg. due to a precondition
|
||||
// not being met.
|
||||
PipelineResultSkip PipelineResultAttr = "skip"
|
||||
)
|
||||
|
||||
// PipelineRunStateAttr is an attribute conforming to the cicd.pipeline.run.state
|
||||
// semantic conventions. It represents the pipeline run goes through these states
|
||||
// during its lifecycle.
|
||||
type PipelineRunStateAttr string
|
||||
|
||||
var (
|
||||
// PipelineRunStatePending is the run pending state spans from the event
|
||||
// triggering the pipeline run until the execution of the run starts (eg. time
|
||||
// spent in a queue, provisioning agents, creating run resources).
|
||||
PipelineRunStatePending PipelineRunStateAttr = "pending"
|
||||
// PipelineRunStateExecuting is the executing state spans the execution of any
|
||||
// run tasks (eg. build, test).
|
||||
PipelineRunStateExecuting PipelineRunStateAttr = "executing"
|
||||
// PipelineRunStateFinalizing is the finalizing state spans from when the run
|
||||
// has finished executing (eg. cleanup of run resources).
|
||||
PipelineRunStateFinalizing PipelineRunStateAttr = "finalizing"
|
||||
)
|
||||
|
||||
// WorkerStateAttr is an attribute conforming to the cicd.worker.state semantic
|
||||
// conventions. It represents the state of a CICD worker / agent.
|
||||
type WorkerStateAttr string
|
||||
|
||||
var (
|
||||
// WorkerStateAvailable is the worker is not performing work for the CICD
|
||||
// system. It is available to the CICD system to perform work on (online /
|
||||
// idle).
|
||||
WorkerStateAvailable WorkerStateAttr = "available"
|
||||
// WorkerStateBusy is the worker is performing work for the CICD system.
|
||||
WorkerStateBusy WorkerStateAttr = "busy"
|
||||
// WorkerStateOffline is the worker is not available to the CICD system
|
||||
// (disconnected / down).
|
||||
WorkerStateOffline WorkerStateAttr = "offline"
|
||||
)
|
||||
|
||||
// ErrorTypeAttr is an attribute conforming to the error.type semantic
|
||||
// conventions. It represents the describes a class of error the operation ended
|
||||
// with.
|
||||
type ErrorTypeAttr string
|
||||
|
||||
var (
|
||||
// ErrorTypeOther is a fallback error value to be used when the instrumentation
|
||||
// doesn't define a custom value.
|
||||
ErrorTypeOther ErrorTypeAttr = "_OTHER"
|
||||
)
|
||||
|
||||
// PipelineRunActive is an instrument used to record metric values conforming to
|
||||
// the "cicd.pipeline.run.active" semantic conventions. It represents the number
|
||||
// of pipeline runs currently active in the system by state.
|
||||
type PipelineRunActive struct {
|
||||
metric.Int64UpDownCounter
|
||||
}
|
||||
|
||||
var newPipelineRunActiveOpts = []metric.Int64UpDownCounterOption{
|
||||
metric.WithDescription("The number of pipeline runs currently active in the system by state."),
|
||||
metric.WithUnit("{run}"),
|
||||
}
|
||||
|
||||
// NewPipelineRunActive returns a new PipelineRunActive instrument.
|
||||
func NewPipelineRunActive(
|
||||
m metric.Meter,
|
||||
opt ...metric.Int64UpDownCounterOption,
|
||||
) (PipelineRunActive, error) {
|
||||
// Check if the meter is nil.
|
||||
if m == nil {
|
||||
return PipelineRunActive{noop.Int64UpDownCounter{}}, nil
|
||||
}
|
||||
|
||||
if len(opt) == 0 {
|
||||
opt = newPipelineRunActiveOpts
|
||||
} else {
|
||||
opt = append(opt, newPipelineRunActiveOpts...)
|
||||
}
|
||||
|
||||
i, err := m.Int64UpDownCounter(
|
||||
"cicd.pipeline.run.active",
|
||||
opt...,
|
||||
)
|
||||
if err != nil {
|
||||
return PipelineRunActive{noop.Int64UpDownCounter{}}, err
|
||||
}
|
||||
return PipelineRunActive{i}, nil
|
||||
}
|
||||
|
||||
// Inst returns the underlying metric instrument.
|
||||
func (m PipelineRunActive) Inst() metric.Int64UpDownCounter {
|
||||
return m.Int64UpDownCounter
|
||||
}
|
||||
|
||||
// Name returns the semantic convention name of the instrument.
|
||||
func (PipelineRunActive) Name() string {
|
||||
return "cicd.pipeline.run.active"
|
||||
}
|
||||
|
||||
// Unit returns the semantic convention unit of the instrument
|
||||
func (PipelineRunActive) Unit() string {
|
||||
return "{run}"
|
||||
}
|
||||
|
||||
// Description returns the semantic convention description of the instrument
|
||||
func (PipelineRunActive) Description() string {
|
||||
return "The number of pipeline runs currently active in the system by state."
|
||||
}
|
||||
|
||||
// Add adds incr to the existing count for attrs.
|
||||
//
|
||||
// The pipelineName is the the human readable name of the pipeline within a CI/CD
|
||||
// system.
|
||||
//
|
||||
// The pipelineRunState is the the pipeline run goes through these states during
|
||||
// its lifecycle.
|
||||
func (m PipelineRunActive) Add(
|
||||
ctx context.Context,
|
||||
incr int64,
|
||||
pipelineName string,
|
||||
pipelineRunState PipelineRunStateAttr,
|
||||
attrs ...attribute.KeyValue,
|
||||
) {
|
||||
if !m.Int64UpDownCounter.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if len(attrs) == 0 {
|
||||
m.Int64UpDownCounter.Add(ctx, incr, metric.WithAttributes(
|
||||
attribute.String("cicd.pipeline.name", pipelineName),
|
||||
attribute.String("cicd.pipeline.run.state", string(pipelineRunState)),
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(
|
||||
*o,
|
||||
metric.WithAttributes(
|
||||
append(
|
||||
attrs[:len(attrs):len(attrs)],
|
||||
attribute.String("cicd.pipeline.name", pipelineName),
|
||||
attribute.String("cicd.pipeline.run.state", string(pipelineRunState)),
|
||||
)...,
|
||||
),
|
||||
)
|
||||
|
||||
m.Int64UpDownCounter.Add(ctx, incr, *o...)
|
||||
}
|
||||
|
||||
// AddSet adds incr to the existing count for set.
|
||||
func (m PipelineRunActive) AddSet(ctx context.Context, incr int64, set attribute.Set) {
|
||||
if !m.Int64UpDownCounter.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if set.Len() == 0 {
|
||||
m.Int64UpDownCounter.Add(ctx, incr)
|
||||
return
|
||||
}
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(*o, metric.WithAttributeSet(set))
|
||||
m.Int64UpDownCounter.Add(ctx, incr, *o...)
|
||||
}
|
||||
|
||||
// PipelineRunDuration is an instrument used to record metric values conforming
|
||||
// to the "cicd.pipeline.run.duration" semantic conventions. It represents the
|
||||
// duration of a pipeline run grouped by pipeline, state and result.
|
||||
type PipelineRunDuration struct {
|
||||
metric.Float64Histogram
|
||||
}
|
||||
|
||||
var newPipelineRunDurationOpts = []metric.Float64HistogramOption{
|
||||
metric.WithDescription("Duration of a pipeline run grouped by pipeline, state and result."),
|
||||
metric.WithUnit("s"),
|
||||
}
|
||||
|
||||
// NewPipelineRunDuration returns a new PipelineRunDuration instrument.
|
||||
func NewPipelineRunDuration(
|
||||
m metric.Meter,
|
||||
opt ...metric.Float64HistogramOption,
|
||||
) (PipelineRunDuration, error) {
|
||||
// Check if the meter is nil.
|
||||
if m == nil {
|
||||
return PipelineRunDuration{noop.Float64Histogram{}}, nil
|
||||
}
|
||||
|
||||
if len(opt) == 0 {
|
||||
opt = newPipelineRunDurationOpts
|
||||
} else {
|
||||
opt = append(opt, newPipelineRunDurationOpts...)
|
||||
}
|
||||
|
||||
i, err := m.Float64Histogram(
|
||||
"cicd.pipeline.run.duration",
|
||||
opt...,
|
||||
)
|
||||
if err != nil {
|
||||
return PipelineRunDuration{noop.Float64Histogram{}}, err
|
||||
}
|
||||
return PipelineRunDuration{i}, nil
|
||||
}
|
||||
|
||||
// Inst returns the underlying metric instrument.
|
||||
func (m PipelineRunDuration) Inst() metric.Float64Histogram {
|
||||
return m.Float64Histogram
|
||||
}
|
||||
|
||||
// Name returns the semantic convention name of the instrument.
|
||||
func (PipelineRunDuration) Name() string {
|
||||
return "cicd.pipeline.run.duration"
|
||||
}
|
||||
|
||||
// Unit returns the semantic convention unit of the instrument
|
||||
func (PipelineRunDuration) Unit() string {
|
||||
return "s"
|
||||
}
|
||||
|
||||
// Description returns the semantic convention description of the instrument
|
||||
func (PipelineRunDuration) Description() string {
|
||||
return "Duration of a pipeline run grouped by pipeline, state and result."
|
||||
}
|
||||
|
||||
// Record records val to the current distribution for attrs.
|
||||
//
|
||||
// The pipelineName is the the human readable name of the pipeline within a CI/CD
|
||||
// system.
|
||||
//
|
||||
// The pipelineRunState is the the pipeline run goes through these states during
|
||||
// its lifecycle.
|
||||
//
|
||||
// All additional attrs passed are included in the recorded value.
|
||||
func (m PipelineRunDuration) Record(
|
||||
ctx context.Context,
|
||||
val float64,
|
||||
pipelineName string,
|
||||
pipelineRunState PipelineRunStateAttr,
|
||||
attrs ...attribute.KeyValue,
|
||||
) {
|
||||
if !m.Float64Histogram.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if len(attrs) == 0 {
|
||||
m.Float64Histogram.Record(ctx, val, metric.WithAttributes(
|
||||
attribute.String("cicd.pipeline.name", pipelineName),
|
||||
attribute.String("cicd.pipeline.run.state", string(pipelineRunState)),
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
o := recOptPool.Get().(*[]metric.RecordOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
recOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(
|
||||
*o,
|
||||
metric.WithAttributes(
|
||||
append(
|
||||
attrs[:len(attrs):len(attrs)],
|
||||
attribute.String("cicd.pipeline.name", pipelineName),
|
||||
attribute.String("cicd.pipeline.run.state", string(pipelineRunState)),
|
||||
)...,
|
||||
),
|
||||
)
|
||||
|
||||
m.Float64Histogram.Record(ctx, val, *o...)
|
||||
}
|
||||
|
||||
// RecordSet records val to the current distribution for set.
|
||||
func (m PipelineRunDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) {
|
||||
if !m.Float64Histogram.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if set.Len() == 0 {
|
||||
m.Float64Histogram.Record(ctx, val)
|
||||
return
|
||||
}
|
||||
|
||||
o := recOptPool.Get().(*[]metric.RecordOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
recOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(*o, metric.WithAttributeSet(set))
|
||||
m.Float64Histogram.Record(ctx, val, *o...)
|
||||
}
|
||||
|
||||
// AttrPipelineResult returns an optional attribute for the
|
||||
// "cicd.pipeline.result" semantic convention. It represents the result of a
|
||||
// pipeline run.
|
||||
func (PipelineRunDuration) AttrPipelineResult(val PipelineResultAttr) attribute.KeyValue {
|
||||
return attribute.String("cicd.pipeline.result", string(val))
|
||||
}
|
||||
|
||||
// AttrErrorType returns an optional attribute for the "error.type" semantic
|
||||
// convention. It represents the describes a class of error the operation ended
|
||||
// with.
|
||||
func (PipelineRunDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue {
|
||||
return attribute.String("error.type", string(val))
|
||||
}
|
||||
|
||||
// PipelineRunErrors is an instrument used to record metric values conforming to
|
||||
// the "cicd.pipeline.run.errors" semantic conventions. It represents the number
|
||||
// of errors encountered in pipeline runs (eg. compile, test failures).
|
||||
type PipelineRunErrors struct {
|
||||
metric.Int64Counter
|
||||
}
|
||||
|
||||
var newPipelineRunErrorsOpts = []metric.Int64CounterOption{
|
||||
metric.WithDescription("The number of errors encountered in pipeline runs (eg. compile, test failures)."),
|
||||
metric.WithUnit("{error}"),
|
||||
}
|
||||
|
||||
// NewPipelineRunErrors returns a new PipelineRunErrors instrument.
|
||||
func NewPipelineRunErrors(
|
||||
m metric.Meter,
|
||||
opt ...metric.Int64CounterOption,
|
||||
) (PipelineRunErrors, error) {
|
||||
// Check if the meter is nil.
|
||||
if m == nil {
|
||||
return PipelineRunErrors{noop.Int64Counter{}}, nil
|
||||
}
|
||||
|
||||
if len(opt) == 0 {
|
||||
opt = newPipelineRunErrorsOpts
|
||||
} else {
|
||||
opt = append(opt, newPipelineRunErrorsOpts...)
|
||||
}
|
||||
|
||||
i, err := m.Int64Counter(
|
||||
"cicd.pipeline.run.errors",
|
||||
opt...,
|
||||
)
|
||||
if err != nil {
|
||||
return PipelineRunErrors{noop.Int64Counter{}}, err
|
||||
}
|
||||
return PipelineRunErrors{i}, nil
|
||||
}
|
||||
|
||||
// Inst returns the underlying metric instrument.
|
||||
func (m PipelineRunErrors) Inst() metric.Int64Counter {
|
||||
return m.Int64Counter
|
||||
}
|
||||
|
||||
// Name returns the semantic convention name of the instrument.
|
||||
func (PipelineRunErrors) Name() string {
|
||||
return "cicd.pipeline.run.errors"
|
||||
}
|
||||
|
||||
// Unit returns the semantic convention unit of the instrument
|
||||
func (PipelineRunErrors) Unit() string {
|
||||
return "{error}"
|
||||
}
|
||||
|
||||
// Description returns the semantic convention description of the instrument
|
||||
func (PipelineRunErrors) Description() string {
|
||||
return "The number of errors encountered in pipeline runs (eg. compile, test failures)."
|
||||
}
|
||||
|
||||
// Add adds incr to the existing count for attrs.
|
||||
//
|
||||
// The pipelineName is the the human readable name of the pipeline within a CI/CD
|
||||
// system.
|
||||
//
|
||||
// The errorType is the describes a class of error the operation ended with.
|
||||
//
|
||||
// There might be errors in a pipeline run that are non fatal (eg. they are
|
||||
// suppressed) or in a parallel stage multiple stages could have a fatal error.
|
||||
// This means that this error count might not be the same as the count of metric
|
||||
// `cicd.pipeline.run.duration` with run result `failure`.
|
||||
func (m PipelineRunErrors) Add(
|
||||
ctx context.Context,
|
||||
incr int64,
|
||||
pipelineName string,
|
||||
errorType ErrorTypeAttr,
|
||||
attrs ...attribute.KeyValue,
|
||||
) {
|
||||
if !m.Int64Counter.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if len(attrs) == 0 {
|
||||
m.Int64Counter.Add(ctx, incr, metric.WithAttributes(
|
||||
attribute.String("cicd.pipeline.name", pipelineName),
|
||||
attribute.String("error.type", string(errorType)),
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(
|
||||
*o,
|
||||
metric.WithAttributes(
|
||||
append(
|
||||
attrs[:len(attrs):len(attrs)],
|
||||
attribute.String("cicd.pipeline.name", pipelineName),
|
||||
attribute.String("error.type", string(errorType)),
|
||||
)...,
|
||||
),
|
||||
)
|
||||
|
||||
m.Int64Counter.Add(ctx, incr, *o...)
|
||||
}
|
||||
|
||||
// AddSet adds incr to the existing count for set.
|
||||
//
|
||||
// There might be errors in a pipeline run that are non fatal (eg. they are
|
||||
// suppressed) or in a parallel stage multiple stages could have a fatal error.
|
||||
// This means that this error count might not be the same as the count of metric
|
||||
// `cicd.pipeline.run.duration` with run result `failure`.
|
||||
func (m PipelineRunErrors) AddSet(ctx context.Context, incr int64, set attribute.Set) {
|
||||
if !m.Int64Counter.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if set.Len() == 0 {
|
||||
m.Int64Counter.Add(ctx, incr)
|
||||
return
|
||||
}
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(*o, metric.WithAttributeSet(set))
|
||||
m.Int64Counter.Add(ctx, incr, *o...)
|
||||
}
|
||||
|
||||
// SystemErrors is an instrument used to record metric values conforming to the
|
||||
// "cicd.system.errors" semantic conventions. It represents the number of errors
|
||||
// in a component of the CICD system (eg. controller, scheduler, agent).
|
||||
type SystemErrors struct {
|
||||
metric.Int64Counter
|
||||
}
|
||||
|
||||
var newSystemErrorsOpts = []metric.Int64CounterOption{
|
||||
metric.WithDescription("The number of errors in a component of the CICD system (eg. controller, scheduler, agent)."),
|
||||
metric.WithUnit("{error}"),
|
||||
}
|
||||
|
||||
// NewSystemErrors returns a new SystemErrors instrument.
|
||||
func NewSystemErrors(
|
||||
m metric.Meter,
|
||||
opt ...metric.Int64CounterOption,
|
||||
) (SystemErrors, error) {
|
||||
// Check if the meter is nil.
|
||||
if m == nil {
|
||||
return SystemErrors{noop.Int64Counter{}}, nil
|
||||
}
|
||||
|
||||
if len(opt) == 0 {
|
||||
opt = newSystemErrorsOpts
|
||||
} else {
|
||||
opt = append(opt, newSystemErrorsOpts...)
|
||||
}
|
||||
|
||||
i, err := m.Int64Counter(
|
||||
"cicd.system.errors",
|
||||
opt...,
|
||||
)
|
||||
if err != nil {
|
||||
return SystemErrors{noop.Int64Counter{}}, err
|
||||
}
|
||||
return SystemErrors{i}, nil
|
||||
}
|
||||
|
||||
// Inst returns the underlying metric instrument.
|
||||
func (m SystemErrors) Inst() metric.Int64Counter {
|
||||
return m.Int64Counter
|
||||
}
|
||||
|
||||
// Name returns the semantic convention name of the instrument.
|
||||
func (SystemErrors) Name() string {
|
||||
return "cicd.system.errors"
|
||||
}
|
||||
|
||||
// Unit returns the semantic convention unit of the instrument
|
||||
func (SystemErrors) Unit() string {
|
||||
return "{error}"
|
||||
}
|
||||
|
||||
// Description returns the semantic convention description of the instrument
|
||||
func (SystemErrors) Description() string {
|
||||
return "The number of errors in a component of the CICD system (eg. controller, scheduler, agent)."
|
||||
}
|
||||
|
||||
// Add adds incr to the existing count for attrs.
|
||||
//
|
||||
// The systemComponent is the the name of a component of the CICD system.
|
||||
//
|
||||
// The errorType is the describes a class of error the operation ended with.
|
||||
//
|
||||
// Errors in pipeline run execution are explicitly excluded. Ie a test failure is
|
||||
// not counted in this metric.
|
||||
func (m SystemErrors) Add(
|
||||
ctx context.Context,
|
||||
incr int64,
|
||||
systemComponent string,
|
||||
errorType ErrorTypeAttr,
|
||||
attrs ...attribute.KeyValue,
|
||||
) {
|
||||
if !m.Int64Counter.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if len(attrs) == 0 {
|
||||
m.Int64Counter.Add(ctx, incr, metric.WithAttributes(
|
||||
attribute.String("cicd.system.component", systemComponent),
|
||||
attribute.String("error.type", string(errorType)),
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(
|
||||
*o,
|
||||
metric.WithAttributes(
|
||||
append(
|
||||
attrs[:len(attrs):len(attrs)],
|
||||
attribute.String("cicd.system.component", systemComponent),
|
||||
attribute.String("error.type", string(errorType)),
|
||||
)...,
|
||||
),
|
||||
)
|
||||
|
||||
m.Int64Counter.Add(ctx, incr, *o...)
|
||||
}
|
||||
|
||||
// AddSet adds incr to the existing count for set.
|
||||
//
|
||||
// Errors in pipeline run execution are explicitly excluded. Ie a test failure is
|
||||
// not counted in this metric.
|
||||
func (m SystemErrors) AddSet(ctx context.Context, incr int64, set attribute.Set) {
|
||||
if !m.Int64Counter.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if set.Len() == 0 {
|
||||
m.Int64Counter.Add(ctx, incr)
|
||||
return
|
||||
}
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(*o, metric.WithAttributeSet(set))
|
||||
m.Int64Counter.Add(ctx, incr, *o...)
|
||||
}
|
||||
|
||||
// WorkerCount is an instrument used to record metric values conforming to the
|
||||
// "cicd.worker.count" semantic conventions. It represents the number of workers
|
||||
// on the CICD system by state.
|
||||
type WorkerCount struct {
|
||||
metric.Int64UpDownCounter
|
||||
}
|
||||
|
||||
var newWorkerCountOpts = []metric.Int64UpDownCounterOption{
|
||||
metric.WithDescription("The number of workers on the CICD system by state."),
|
||||
metric.WithUnit("{count}"),
|
||||
}
|
||||
|
||||
// NewWorkerCount returns a new WorkerCount instrument.
|
||||
func NewWorkerCount(
|
||||
m metric.Meter,
|
||||
opt ...metric.Int64UpDownCounterOption,
|
||||
) (WorkerCount, error) {
|
||||
// Check if the meter is nil.
|
||||
if m == nil {
|
||||
return WorkerCount{noop.Int64UpDownCounter{}}, nil
|
||||
}
|
||||
|
||||
if len(opt) == 0 {
|
||||
opt = newWorkerCountOpts
|
||||
} else {
|
||||
opt = append(opt, newWorkerCountOpts...)
|
||||
}
|
||||
|
||||
i, err := m.Int64UpDownCounter(
|
||||
"cicd.worker.count",
|
||||
opt...,
|
||||
)
|
||||
if err != nil {
|
||||
return WorkerCount{noop.Int64UpDownCounter{}}, err
|
||||
}
|
||||
return WorkerCount{i}, nil
|
||||
}
|
||||
|
||||
// Inst returns the underlying metric instrument.
|
||||
func (m WorkerCount) Inst() metric.Int64UpDownCounter {
|
||||
return m.Int64UpDownCounter
|
||||
}
|
||||
|
||||
// Name returns the semantic convention name of the instrument.
|
||||
func (WorkerCount) Name() string {
|
||||
return "cicd.worker.count"
|
||||
}
|
||||
|
||||
// Unit returns the semantic convention unit of the instrument
|
||||
func (WorkerCount) Unit() string {
|
||||
return "{count}"
|
||||
}
|
||||
|
||||
// Description returns the semantic convention description of the instrument
|
||||
func (WorkerCount) Description() string {
|
||||
return "The number of workers on the CICD system by state."
|
||||
}
|
||||
|
||||
// Add adds incr to the existing count for attrs.
|
||||
//
|
||||
// The workerState is the the state of a CICD worker / agent.
|
||||
func (m WorkerCount) Add(
|
||||
ctx context.Context,
|
||||
incr int64,
|
||||
workerState WorkerStateAttr,
|
||||
attrs ...attribute.KeyValue,
|
||||
) {
|
||||
if !m.Int64UpDownCounter.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if len(attrs) == 0 {
|
||||
m.Int64UpDownCounter.Add(ctx, incr, metric.WithAttributes(
|
||||
attribute.String("cicd.worker.state", string(workerState)),
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(
|
||||
*o,
|
||||
metric.WithAttributes(
|
||||
append(
|
||||
attrs[:len(attrs):len(attrs)],
|
||||
attribute.String("cicd.worker.state", string(workerState)),
|
||||
)...,
|
||||
),
|
||||
)
|
||||
|
||||
m.Int64UpDownCounter.Add(ctx, incr, *o...)
|
||||
}
|
||||
|
||||
// AddSet adds incr to the existing count for set.
|
||||
func (m WorkerCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
|
||||
if !m.Int64UpDownCounter.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if set.Len() == 0 {
|
||||
m.Int64UpDownCounter.Add(ctx, incr)
|
||||
return
|
||||
}
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(*o, metric.WithAttributeSet(set))
|
||||
m.Int64UpDownCounter.Add(ctx, incr, *o...)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,156 @@
|
||||
// Code generated from semantic convention specification. DO NOT EDIT.
|
||||
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package dnsconv provides types and functionality for OpenTelemetry semantic
|
||||
// conventions in the "dns" namespace.
|
||||
package dnsconv
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/metric/noop"
|
||||
)
|
||||
|
||||
var (
|
||||
addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }}
|
||||
recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }}
|
||||
)
|
||||
|
||||
// ErrorTypeAttr is an attribute conforming to the error.type semantic
|
||||
// conventions. It represents the describes the error the DNS lookup failed with.
|
||||
type ErrorTypeAttr string
|
||||
|
||||
var (
|
||||
// ErrorTypeOther is a fallback error value to be used when the instrumentation
|
||||
// doesn't define a custom value.
|
||||
ErrorTypeOther ErrorTypeAttr = "_OTHER"
|
||||
)
|
||||
|
||||
// LookupDuration is an instrument used to record metric values conforming to the
|
||||
// "dns.lookup.duration" semantic conventions. It represents the measures the
|
||||
// time taken to perform a DNS lookup.
|
||||
type LookupDuration struct {
|
||||
metric.Float64Histogram
|
||||
}
|
||||
|
||||
var newLookupDurationOpts = []metric.Float64HistogramOption{
|
||||
metric.WithDescription("Measures the time taken to perform a DNS lookup."),
|
||||
metric.WithUnit("s"),
|
||||
}
|
||||
|
||||
// NewLookupDuration returns a new LookupDuration instrument.
|
||||
func NewLookupDuration(
|
||||
m metric.Meter,
|
||||
opt ...metric.Float64HistogramOption,
|
||||
) (LookupDuration, error) {
|
||||
// Check if the meter is nil.
|
||||
if m == nil {
|
||||
return LookupDuration{noop.Float64Histogram{}}, nil
|
||||
}
|
||||
|
||||
if len(opt) == 0 {
|
||||
opt = newLookupDurationOpts
|
||||
} else {
|
||||
opt = append(opt, newLookupDurationOpts...)
|
||||
}
|
||||
|
||||
i, err := m.Float64Histogram(
|
||||
"dns.lookup.duration",
|
||||
opt...,
|
||||
)
|
||||
if err != nil {
|
||||
return LookupDuration{noop.Float64Histogram{}}, err
|
||||
}
|
||||
return LookupDuration{i}, nil
|
||||
}
|
||||
|
||||
// Inst returns the underlying metric instrument.
|
||||
func (m LookupDuration) Inst() metric.Float64Histogram {
|
||||
return m.Float64Histogram
|
||||
}
|
||||
|
||||
// Name returns the semantic convention name of the instrument.
|
||||
func (LookupDuration) Name() string {
|
||||
return "dns.lookup.duration"
|
||||
}
|
||||
|
||||
// Unit returns the semantic convention unit of the instrument
|
||||
func (LookupDuration) Unit() string {
|
||||
return "s"
|
||||
}
|
||||
|
||||
// Description returns the semantic convention description of the instrument
|
||||
func (LookupDuration) Description() string {
|
||||
return "Measures the time taken to perform a DNS lookup."
|
||||
}
|
||||
|
||||
// Record records val to the current distribution for attrs.
|
||||
//
|
||||
// The questionName is the the name being queried.
|
||||
//
|
||||
// All additional attrs passed are included in the recorded value.
|
||||
func (m LookupDuration) Record(
|
||||
ctx context.Context,
|
||||
val float64,
|
||||
questionName string,
|
||||
attrs ...attribute.KeyValue,
|
||||
) {
|
||||
if !m.Float64Histogram.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if len(attrs) == 0 {
|
||||
m.Float64Histogram.Record(ctx, val, metric.WithAttributes(
|
||||
attribute.String("dns.question.name", questionName),
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
o := recOptPool.Get().(*[]metric.RecordOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
recOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(
|
||||
*o,
|
||||
metric.WithAttributes(
|
||||
append(
|
||||
attrs[:len(attrs):len(attrs)],
|
||||
attribute.String("dns.question.name", questionName),
|
||||
)...,
|
||||
),
|
||||
)
|
||||
|
||||
m.Float64Histogram.Record(ctx, val, *o...)
|
||||
}
|
||||
|
||||
// RecordSet records val to the current distribution for set.
|
||||
func (m LookupDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) {
|
||||
if !m.Float64Histogram.Enabled(ctx) {
|
||||
return
|
||||
}
|
||||
if set.Len() == 0 {
|
||||
m.Float64Histogram.Record(ctx, val)
|
||||
return
|
||||
}
|
||||
|
||||
o := recOptPool.Get().(*[]metric.RecordOption)
|
||||
defer func() {
|
||||
*o = (*o)[:0]
|
||||
recOptPool.Put(o)
|
||||
}()
|
||||
|
||||
*o = append(*o, metric.WithAttributeSet(set))
|
||||
m.Float64Histogram.Record(ctx, val, *o...)
|
||||
}
|
||||
|
||||
// AttrErrorType returns an optional attribute for the "error.type" semantic
|
||||
// convention. It represents the describes the error the DNS lookup failed with.
|
||||
func (LookupDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue {
|
||||
return attribute.String("error.type", string(val))
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Code generated from semantic convention specification. DO NOT EDIT.
|
||||
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package semconv implements OpenTelemetry semantic conventions.
|
||||
//
|
||||
// OpenTelemetry semantic conventions are agreed standardized naming
|
||||
// patterns for OpenTelemetry things. This package represents the v1.41.0
|
||||
// version of the OpenTelemetry semantic conventions.
|
||||
package semconv // import "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
@@ -0,0 +1,83 @@
|
||||
// Code generated from semantic convention specification. DO NOT EDIT.
|
||||
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package semconv // import "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
)
|
||||
|
||||
// ErrorType returns an [attribute.KeyValue] identifying the error type of err.
|
||||
//
|
||||
// If err is nil, the returned attribute has the default value
|
||||
// [ErrorTypeOther].
|
||||
//
|
||||
// If err or one of the errors in its chain has the method
|
||||
//
|
||||
// ErrorType() string
|
||||
//
|
||||
// the returned attribute has that method's return value. If multiple errors in
|
||||
// the chain implement this method, the value from the first match found by
|
||||
// [errors.As] is used. Otherwise, the returned attribute has a value derived
|
||||
// from the concrete type of err after unwrapping any wrappers created with
|
||||
// [fmt.Errorf].
|
||||
//
|
||||
// The key of the returned attribute is [ErrorTypeKey].
|
||||
func ErrorType(err error) attribute.KeyValue {
|
||||
if err == nil {
|
||||
return ErrorTypeOther
|
||||
}
|
||||
|
||||
return ErrorTypeKey.String(errorType(err))
|
||||
}
|
||||
|
||||
func errorType(err error) string {
|
||||
var s string
|
||||
if et, ok := err.(interface{ ErrorType() string }); ok {
|
||||
// Fast path: check the top-level error first.
|
||||
s = et.ErrorType()
|
||||
} else {
|
||||
// Fallback: search the error chain for an ErrorType method.
|
||||
var et interface{ ErrorType() string }
|
||||
if errors.As(err, &et) {
|
||||
// Prioritize the ErrorType method if available.
|
||||
s = et.ErrorType()
|
||||
}
|
||||
}
|
||||
if s == "" {
|
||||
// Fallback to reflection if the ErrorType method is not supported or
|
||||
// returns an empty value.
|
||||
|
||||
t := reflect.TypeOf(unwrapFmtWrapped(err))
|
||||
pkg, name := t.PkgPath(), t.Name()
|
||||
if pkg != "" && name != "" {
|
||||
s = pkg + "." + name
|
||||
} else {
|
||||
// The type has no package path or name (predeclared, not-defined,
|
||||
// or alias for a not-defined type).
|
||||
//
|
||||
// This is not guaranteed to be unique, but is a best effort.
|
||||
s = t.String()
|
||||
}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
var fmtWrapErrorType = reflect.TypeOf(fmt.Errorf("wrapped: %w", errors.New("err")))
|
||||
|
||||
func unwrapFmtWrapped(err error) error {
|
||||
for reflect.TypeOf(err) == fmtWrapErrorType {
|
||||
u := errors.Unwrap(err)
|
||||
if u == nil {
|
||||
return err // When the wrapped error is nil, use the concrete type of the wrapper.
|
||||
}
|
||||
err = u
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
// Code generated from semantic convention specification. DO NOT EDIT.
|
||||
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package semconv // import "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
const pkg = "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
|
||||
func TestErrorType(t *testing.T) {
|
||||
check(t, nil, ErrorTypeOther.Value.AsString())
|
||||
check(t, errors.New("msg"), "*errors.errorString")
|
||||
check(t, custom("aborted"), "aborted")
|
||||
check(t, errors.Join(custom("left"), custom("right")), "left") // first errors.As match is used.
|
||||
check(t, custom(""), pkg+".ErrCustomType") // empty ErrorType, use concrete type.
|
||||
check(t, wrapped(custom("wrapped-aborted")), "wrapped-aborted")
|
||||
check(t, wrapped(custom("")), pkg+".wrappedErr") // empty ErrorType in chain, use concrete top-level type.
|
||||
check(t, fmtWrapped(custom("")), pkg+".ErrCustomType")
|
||||
check(t, fmtWrapped(wrapped(custom(""))), pkg+".wrappedErr")
|
||||
check(t, fmtWrapped(fmtWrapped(custom(""))), pkg+".ErrCustomType")
|
||||
check(t, fmtWrapped(nil), fmtWrapErrorType.String()) // fmt.Errorf with nil error, use concrete type of the wrapper.
|
||||
}
|
||||
|
||||
func check(t *testing.T, err error, want string) {
|
||||
t.Helper()
|
||||
got := ErrorType(err)
|
||||
if got.Key != ErrorTypeKey {
|
||||
t.Errorf("ErrorType(%v) key = %v, want %v", err, got.Key, ErrorTypeKey)
|
||||
}
|
||||
if got.Value.AsString() != want {
|
||||
t.Errorf("ErrorType(%v) value = %v, want %v", err, got.Value.AsString(), want)
|
||||
}
|
||||
}
|
||||
|
||||
func custom(typ string) error {
|
||||
return ErrCustomType{Type: typ}
|
||||
}
|
||||
|
||||
func wrapped(err error) error {
|
||||
return wrappedErr{err: err}
|
||||
}
|
||||
|
||||
func fmtWrapped(err error) error {
|
||||
return fmt.Errorf("wrapped: %w", err)
|
||||
}
|
||||
|
||||
type ErrCustomType struct {
|
||||
Type string
|
||||
}
|
||||
|
||||
func (e ErrCustomType) Error() string {
|
||||
return "custom: " + e.Type
|
||||
}
|
||||
|
||||
func (e ErrCustomType) ErrorType() string {
|
||||
return e.Type
|
||||
}
|
||||
|
||||
type wrappedErr struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func (e wrappedErr) Error() string {
|
||||
return "wrapped: " + e.err.Error()
|
||||
}
|
||||
|
||||
func (e wrappedErr) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Code generated from semantic convention specification. DO NOT EDIT.
|
||||
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package semconv // import "go.opentelemetry.io/otel/semconv/v1.41.0"
|
||||
|
||||
const (
|
||||
// ExceptionEventName is the name of the Span event representing an exception.
|
||||
ExceptionEventName = "exception"
|
||||
)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user